![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
Altynai0514
人类的生活因为优秀的程序员和美妙的程序而变得更加美好
展开
-
关于python文件操作
python中对文件、文件夹(文件操作函数)的操作需要涉及到os模块和shutil模块。 得到当前工作目录,即当前Python脚本工作的目录路径: os.getcwd() 返回指定目录下的所有文件和目录名:os.listdir() 函数用来删除一个文件:os.remove() 删除多个目录:os.removedirs(r“c:\python”) 检验给出的路径是否是一转载 2014-03-05 15:06:57 · 536 阅读 · 0 评论 -
python学习——python中执行shell命令
这里介绍一下python执行shell命令的四种方法: 1、os模块中的os.system()这个函数来执行shell命令 1 2 3 >>> os.system('ls') anaconda-ks.cfg install.log install.log.syslog send_sms_service.py转载 2014-03-05 15:09:57 · 748 阅读 · 0 评论 -
python两个 list 获取交集,并集,差集的方法
#方法一: a=[2,3,4,5] b=[2,5,8] tmp = [val for val in a if val in b] print tmp #[2, 5] #方法二 print list(set(a).intersection(set(b))) 2. 获取两个list 的并集 print list(set(a)转载 2016-10-20 14:32:12 · 617 阅读 · 0 评论