"""利用os模块编写一个能实现dir -l输出的程序。"""import osfrom datetime import datetimefor x in os.listdir('.'): s = os.path.getsize(x) d = ' ' if os.path.isdir(x): d = '<DIR>' s = ' ' print(datetime.fromtimestamp(os.path.getctime(x)).strftime('%Y-%m-%d %H:%M'), ' ', d, ' ', s, ' ', x)
Sign in to make a reply
渊