方法一
采用% 而不是!
%cd SwitchFrequencyAnalysis
更改笔记本环境的当前工作目录(而不仅仅是运行!命令的子外壳)。
您可以使用以下pwd命令确认它是否起作用:
!pwd
有关jupyter / ipython魔术的更多信息:http 😕/ipython.readthedocs.io/en/stable/interactive/magics.html#magic-cd
方法二
!mkdir abc
!echo “file” > abc/123.txt
import os
os.chdir(‘abc’)
Now the directory ‘abc’ is the current working directory.
and will show 123.txt.
!ls