os模块提供了很多与操作系统交互的函数: import os os.getcwd() # Return the current working directory 'C:\\Python27' os.chdir('/server/accesslogs') # Change current working directory os.system('mkdir ...
现在你可能注意到大多数容器对象都可以用for遍历:for element in : print element for element in (1, 2, 3): print element for key in {'one':1, 'two':2}: print key for char in "123": print char for line in ...