摘要: #coding=utf-8 import os,time while True: cmd='ps -e|grep %s'%('python3') a=os.popen(cmd)#返回一个对象 txt=a.readlines() if len(txt)==0: print('没有') break else: ... 阅读全文
posted @ 2018-08-21 18:36 Sky__liu 阅读(2364) 评论(0) 推荐(0)
摘要: 字节串的构造函数: bytes() #生成一个字的字节串,等同于b'' bytes(整数可迭代对象) 用可换代对象创建一个字节串 bytes(整数n) 生成n个值为0的字节串 bytes(字符串,encoding='utf8') 用字符串的转换编码生成一个字节串bytes的运算: 与其它序列的去处规则完全相同: + +... 阅读全文
posted @ 2018-08-21 16:54 Sky__liu 阅读(1694) 评论(0) 推荐(0)
摘要: https://www.cnblogs.com/JayeHe/p/7442311.html python 协程, 异步IO Select 和 selectors 模块 阅读全文
posted @ 2018-08-21 16:23 Sky__liu 阅读(145) 评论(0) 推荐(0)
摘要: import os,shutil def mycopyfile(srcfile,dstfile): if not os.path.isfile(srcfile): print ("%s not exist!"%(srcfile)) else: fpath=os.path.dirname(srcfile) #获取文件路径 if ... 阅读全文
posted @ 2018-08-21 16:21 Sky__liu 阅读(6899) 评论(0) 推荐(0)
摘要: 作用是生成一个个性化的可迭代对象 函数 zip (iter1 [,iter2[...]]) 返回一个zip对象,此对象用于生成元组,此元组的每个数据来源于参数 中的可对象,当最小的可迭代对象不再提供数据时迭代结束 enumetate(iterable [ , start]) 生成带索引的枚举对象,返 阅读全文
posted @ 2018-08-21 15:51 Sky__liu 阅读(119) 评论(0) 推荐(0)
摘要: 通过以上例子,可知道 ==>>生成器表达式是现用现生成,列表推导式是一次性生成静态数据 阅读全文
posted @ 2018-08-21 14:53 Sky__liu 阅读(826) 评论(0) 推荐(0)