- 论坛徽章:
- 0
|
个人认为3.0b1 下实现最简单的方法,求最简单的实现方法
print([object, ...][, sep=' '][, end='n'][, file=sys.stdout])
Print object(s) to the stream file, separated by sep and followed by end. sep, end and file, if present, must be given as keyword arguments.
All non-keyword arguments are converted to strings like str() does and written to the stream, separated by sep and followed by end. Both sep and end must be strings; they can also be None, which means to use the default values. If no object is given, print() will just write end.
The file argument must be an object with a write(string) method; if it is not present or None, sys.stdout will be used.
IDLE 3.0b1
个人认为3.0b1 下实现最简单的方法,求最简单的实现方法
>>> import os
>>> import time
>>> f=os.listdir('d:\\')
>>> a=open('c:\\a.csv','w')
>>> for row in f:
i=os.path.join('D:\\',row)
o=time.gmtime(os.path.getctime(i))
t=time.strftime("%Y%m%d",o)
print(row,t,sep=',',file=a)
>>>
文件写入 a.csv
Foxmail 20070515
语音 20061113
Recycled 20030814
Downloads 20070516
Program Files 20070516
hp打印机 20070703
17173游戏下载站 20070526
Favorites 20070515
My Documents 20070515
kabasiji6.0.2.621 20071024
TDdownload 20071025
Beyond.csv 20080622
KV-Back.vir 20031029
My Music 20030930
System Volume Information 20031027
[ 本帖最后由 lan97 于 2008-6-22 11:42 编辑 ] |
|