pyton清空当前目录下当前文件以外的所有文件,pyton当前目录,pyton清空当前目录下
pyton清空当前目录下当前文件以外的所有文件,pyton当前目录,pyton清空当前目录下
pyton清空当前目录下当前文件以外的所有文件,除本脚本文件的所有文本文件(点文件不在此列)1.[代码][Python]代码
#!/usr/local/bin/python2import osfiles = os.listdir(os.getcwd())for one_file in files: if os.path.isfile(one_file) and one_file != os.path.basename(__file__): (open(one_file, 'w')).truncate()print "Done!"
编橙之家文章,
相关内容
- 我使用Python计算日志文件中IP的次数,python日志文件,我
- Python方法求水仙花数原码实例,python水仙花,用Python编程
- 数据包分析ascii转码操作方法,ascii操作方法,关于数据
- 下载百度空间文章python源码,百度文章python源码,纯py
- 显示压缩文件内容Python源码,压缩文件python源码,zip压缩
- Python判断统计每个月天数源码示例,python源码,如何利用
- Python方法完成转换英文字符操作,,本文是关于Python方
- Python利用有道翻译开发API应用示例,pythonapi,本贴Pytho
- Python方法的xls与csv转换源码,pythonxlscsv源码,此贴pytho
- python链表应用源码示例,python源码示例,python链表应用源
评论关闭