【Python】系统模块os下的路径操作

2018-08-24  本文已影响6人  Natsuka
os模块:系统模块
常用命令
os.getcwd()
# 'C:\\Users\\Administrator'
os.chdir('C:\\Users\\Administrator\\Desktop')
os.path.split('C:\\Users\\Administrator\\Desktop\\lianxi\\test2.txt')
# ('C:\\Users\\Administrator\\Desktop\\lianxi', 'test2.txt')
os.path.exists('C:\\Users\\Administrator\\Desktop\\lianxi\\test2.txt') # False
os.path.exists('C:\\Users\\Administrator\\Desktop\\lianxi') # True
上一篇 下一篇

猜你喜欢

热点阅读