时间转换
import time
print time.strftime('%Y年%m月%d日',time.localtime())
2007年03月07日
time.strptime("2002年2月2","%Y年%m月%d")
(2002, 2, 2, 0, 0, 0, 5, 33, -1)
a=time.strptime("2002年2月2","%Y年%m月%d")
print time.strftime('%Y年%m月%d日',a)
2002年02月02日
让idle使用utf-8编码
设定Options/General/Default Source Encoding/UTF-8 来支持
python怎么copy文件
>>> import shutil
>>> dir(shutil)
['Error', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '_samefi
le', 'abspath', 'copy', 'copy2', 'copyfile', 'copyfileobj', 'copymode', 'copysta
t', 'copytree', 'destinsrc', 'move', 'os', 'rmtree', 'stat', 'sys']
>>> shutil.copyfile('d:/c.sql','d:/cc.sql')
>>>
python怎么copy目录
>>> import shutil
>>> shutil.copytree('d:/test','d:/testd')
>>>