上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页
  2018年8月4日
摘要: 该模块可以把一个类型,如数字,转成固定长度的bytes 阅读全文
posted @ 2018-08-04 09:13 蜗牛也是妞 阅读(344) 评论(0) 推荐(0)
摘要: import subprocess ''' sh-3.2# ls /Users/egon/Desktop |grep txt$ mysql.txt tt.txt 事物.txt ''' #1 Linux下,通过python运行终端代码: res1=subprocess.Popen('ls /Users/jieli/Desktop', shell=... 阅读全文
posted @ 2018-08-04 09:11 蜗牛也是妞 阅读(373) 评论(0) 推荐(0)
摘要: hash:一种算法 ,3.x里代替了md5模块和sha模块,主要提供 SHA1, SHA224, SHA256, SHA384, SHA512 ,MD5 算法 三个特点: 1.内容相同则hash运算结果相同,内容稍微改变则hash值则变 2.不可逆推 3.相同算法:无论校验多长的数据,得到的哈希值长 阅读全文
posted @ 2018-08-04 09:09 蜗牛也是妞 阅读(401) 评论(0) 推荐(0)
  2018年8月3日
摘要: 配置文件如下: import configparser config = configparser.ConfigParser() config["DEFAULT"] = {'ServerAliveInterval': '45', 'Compression': 'yes', 'CompressionL 阅读全文
posted @ 2018-08-03 20:47 蜗牛也是妞 阅读(460) 评论(0) 推荐(0)
摘要: #日志就级别 CRITICAL = 50 #FATAL = CRITICAL ERROR = 40 WARNING = 30 #WARN = WARNING INFO = 20 DEBUG = 10 NOTSET = 0 #不设置 logging.debug('debug') # 10 loggin 阅读全文
posted @ 2018-08-03 20:27 蜗牛也是妞 阅读(301) 评论(0) 推荐(0)
摘要: print(random.random())#(0,1)----float大于0且小于1之间的小数 print(random.randint(1,3)) #[1,3] 大于等于1且小于等于3之间的整数 print(random.randrange(1,3)) #[1,3) 大于等于1且小于3之间的整数 print(random.choice([1,'23', [4,5]])) #1或者23... 阅读全文
posted @ 2018-08-03 20:25 蜗牛也是妞 阅读(197) 评论(0) 推荐(0)
摘要: # 匹配模式 #一对一的匹配 # 'hello'.replace(old,new) # 'hello'.find('pattern') #正则匹配 import re #\w与\W print(re.findall('\w','hello egon 123')) #['h', 'e', 'l', ' 阅读全文
posted @ 2018-08-03 20:21 蜗牛也是妞 阅读(250) 评论(0) 推荐(0)
摘要: sys.argv #命令行参数List,第一个元素是程序本身路径 sys.exit(n) #退出程序,正常退出时exit(0) sys.version #获取Python解释程序的版本信息 sys.maxint #最大的Int值 sys.path #返回模块的搜索路径,初始化时使用PYTHONPATH环境变量... 阅读全文
posted @ 2018-08-03 20:17 蜗牛也是妞 阅读(253) 评论(0) 推荐(0)
摘要: xml的格式如下,就是通过<>节点来区别数据结构的: 阅读全文
posted @ 2018-08-03 20:12 蜗牛也是妞 阅读(233) 评论(0) 推荐(0)
摘要: JSON表示的对象就是标准的JavaScript语言的对象,JSON和Python内置的数据类型对应如下: shelve 模块 shelve模块比pickle模块简单,只有一个open函数,返回类似字典的对象,可读可写;key必须为字符串,而值可以是python所支持的数据类型 阅读全文
posted @ 2018-08-03 20:02 蜗牛也是妞 阅读(230) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页