#!/usr/bin/env python
import os
print(os.getcwd())
print(os.chdir(".."))
print(os.chdir('c:\'))
print(os.getcwd())
print(os.chdir(r'F:pythons14dya5 ime'))
print(os.getcwd())
print(os.curdir)
print(os.pardir)
print(os.makedirs(r'F:acd'))
print(os.removedirs(r'F:acd'))#清现空文件夹
print(os.mkdir('ab'))#只能建当前目录下的子目录
print(os.rmdir('ab'))#只删当前目录下的子目录
print(os.listdir())
#os.remove()
#os.renames()
#os.stat('')
print(os.sep)#路径分隔符
print(os.linesep)#换行
print(os.pathsep)#分隔符,环境变量等不同之间的分隔符,区分不同系统
print(os.environ)
print(os.name)
#os.system('dir')
#os.system('ipconfig /all')
print(os.path.abspath('__file__'))
print(os.path.split(r'F:pythons14dya5 ime ime1.txt'))
#os.path.dirname(path)
print(os.path.dirname(r'F:pythons14dya5 ime ime1.txt'))
print(os.path.basename(r'F:pythons14dya5 ime ime1.txt'))
print(os.path.exists(r'F:pythons14dya5 ime ime1.txt'))
print(os.path.isabs(r'F:pythons14dya5 ime ime1.txt'))
print(os.path.isfile(r'F:pythons14dya5 ime ime1.txt'))
print(os.path.isdir(r'F:pythons14dya5 ime ime1.txt'))
print(os.path.join('c:\','a','b'))
print(os.path.getatime(r'F:pythons14dya5 ime ime1.py'))
print(os.path.getmtime(r'F:pythons14dya5 ime ime1.py'))
F:pythons14dya5 ime
None
None
c:
None
F:pythons14dya5 ime
.
..
None
None
None
None
['os1.py', 'random1.py', 'time1.py']
;
environ({'ALLUSERSPROFILE': 'C:\ProgramData', 'APPDATA': 'C:\Users\mxf\AppData\Roaming', 'COMMONPROGRAMFILES': 'C:\Program Files\Common Files', 'COMMONPROGRAMFILES(X86)': 'C:\Program Files (x86)\Common Files', 'COMMONPROGRAMW6432': 'C:\Program Files\Common Files', 'COMPUTERNAME': 'MXF-PC', 'COMSPEC': 'C:\Windows\system32\cmd.exe', 'DEVMGR_SHOW_DETAILS': '1', 'FP_NO_HOST_CHECK': 'NO', 'HOMEDRIVE': 'C:', 'HOMEPATH': '\Users\mxf', 'LNKEVN': 'C:\Program Files (x86)\Internet Explorer\iexplore.exe', 'LOCALAPPDATA': 'C:\Users\mxf\AppData\Local', 'LOGONSERVER': '\\MXF-PC', 'NUMBER_OF_PROCESSORS': '4', 'OS': 'Windows_NT', 'PATH': 'C:\Python37\Scripts\;C:\Python37\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Python37\Scripts\;C:\Python37\;F:\python\s14\venv\Scripts', 'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW', 'PROCESSOR_ARCHITECTURE': 'AMD64', 'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel', 'PROCESSOR_LEVEL': '6', 'PROCESSOR_REVISION': '3c03', 'PROGRAMDATA': 'C:\ProgramData', 'PROGRAMFILES': 'C:\Program Files', 'PROGRAMFILES(X86)': 'C:\Program Files (x86)', 'PROGRAMW6432': 'C:\Program Files', 'PROMPT': '(venv) $P$G', 'PSMODULEPATH': 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\', 'PUBLIC': 'C:\Users\Public', 'PYCHARM_HOSTED': '1', 'PYCHARM_MATPLOTLIB_PORT': '53900', 'PYTHONIOENCODING': 'UTF-8', 'PYTHONPATH': 'C:\Program Files\JetBrains\PyCharm 2018.2.3\helpers\pycharm_matplotlib_backend;F:\python\s14;G:\python\python 3\第05周-Python3.5-零基础-高级-完整项目剖析-共14章节\第五周-源码;G:\python\python 3\第03周-Python3.5-零基础-高级-完整项目剖析-共19章节\第三周-源码;G:\python\python 3\第02周-Python3.5-零基础-高级-完整项目剖析-共14章节\源码;G:\python\python 3\第04周-Python3.5-零基础-高级-完整项目剖析-共18章节\第四周-源码', 'PYTHONUNBUFFERED': '1', 'SESSIONNAME': 'Console', 'SYSTEMDRIVE': 'C:', 'SYSTEMROOT': 'C:\Windows', 'TEMP': 'C:\Users\mxf\AppData\Local\Temp', 'TMP': 'C:\Users\mxf\AppData\Local\Temp', 'USERDOMAIN': 'mxf-PC', 'USERNAME': 'mxf', 'USERPROFILE': 'C:\Users\mxf', 'VIRTUAL_ENV': 'F:\python\s14\venv', 'WINDIR': 'C:\Windows', 'WINDOWS_TRACING_FLAGS': '3', 'WINDOWS_TRACING_LOGFILE': 'C:\BVTBin\Tests\installpackage\csilogfile.log', '_OLD_VIRTUAL_PATH': 'C:\Python37\Scripts\;C:\Python37\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Python37\Scripts\;C:\Python37\', '_OLD_VIRTUAL_PROMPT': '$P$G'})
nt
F:pythons14dya5 ime\__file__
('F:\python\s14\dya5\time', 'time1.txt')
F:pythons14dya5 ime
time1.txt
False
True
False
False
c:a
1541852495.6595716
1541852495.7025743