7 07年03月

python tips

关键字:,
贝贝爸 发表在 原创技术文章 |

时间转换

  1. import time 
  2. print time.strftime('%Y年%m月%d日',time.localtime()) 
  3. 20070307日 
  4. time.strptime("2002年2月2","%Y年%m月%d") 
  5. (2002, 2, 2, 0, 0, 0, 5, 33, -1) 
  6. a=time.strptime("2002年2月2","%Y年%m月%d") 
  7. print time.strftime('%Y年%m月%d日',a) 
  8. 20020202

让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')
>>>

相关文章

发表评论

美体小铺急救棒 the bodyshop body shop 美体小铺茶树精油 美体小铺接骨木花眼胶 美体小铺VE眼霜
15Q.0.655Ss.