Mac 中使用os模块更改文件路径
cmd+opt+c 复制路径
path='/Applications/MAMP/htdocs/python/day04model/'
import sys
import os
sys.path.append(path)
import test01_md
test01_md.func1()
系统工作平台的名字
print(os.name)
当前脚本工作路径
print(os.getcwd())
点前文件夹下文件目录名
print(os.listdir())
改变工作路径
os.chdir('')
删除文件
os.remove('.py')
处理文件路径和文件名
n=os.path.split('/Applications/MAMP/htdocs/python/day04model/test01_md.py')
print(n)
判断文件、路径是否存在
print(os.path.exists('/Applications/MAMP/htdocs/python/day04model/test01_md.py'))
print(os.path.exists('/Applications/MAMP/htdocs/python/day04model'))
sys模块
import sys list1= sys.version list2= sys.path
相关推荐
Micusd 2020-11-19
cheidou 2020-11-19
星马殇 2020-11-18
Echodat 2020-10-08
flyToSkyL 2020-09-11
zjc 2020-09-03
阳光普照 2020-09-01
十年砍柴 2020-08-30
猪猪侠喜欢躲猫猫 2020-08-17
ladewang 2020-08-17
渣渣灰 2020-08-13
blankt 2020-08-15
vickay 2020-08-09
TinyDolphin 2020-08-09
山兔与孟婆 2020-08-09
longjing 2020-08-07
xiaogoua 2020-08-06