摘要: #_author:来童星#date:2019/11/10import resource='1-2 * ((60-30+(-40 / 5) * (9-2 * 5 / 3+ 7/3 * 99/4 *2998+10*568/14))-(-4*3)/(16-3*2))'#做检查def check(s): f 阅读全文
posted @ 2019-11-10 22:09 Stary_tx 阅读(1511) 评论(0) 推荐(0) 编辑
摘要: #_author:Administrator#date:2019/11/9#前面的 * + ? 都是贪婪匹配,如果要最少匹配的话,则在后面加 ?import re#1.贪婪匹配ret=re.findall('star*','starrrrrr')print(ret)# ['starrrrrr']#2 阅读全文
posted @ 2019-11-09 12:21 Stary_tx 阅读(236) 评论(0) 推荐(0) 编辑
摘要: #_author:Star#date:2019/11/8#正则表达式的方法#1. findall()-->所有的结果都返回到一个列表里#2. search() >返回匹配到的第一个对象,对象可以调用group()方法返回结果#3. match() >只在字符串开始匹配,,对象可以调用group()方 阅读全文
posted @ 2019-11-08 11:16 Stary_tx 阅读(212) 评论(0) 推荐(0) 编辑
摘要: #_author:Star#date:2019/11/8#1.[]字符集import reret=re.findall('a[c,d,e]b','aeb')print(ret)#aebret1=re.findall('[a-z]','axb')print(ret1)#['a', 'x', 'b']# 阅读全文
posted @ 2019-11-08 11:15 Stary_tx 阅读(211) 评论(0) 推荐(0) 编辑
摘要: #_author:Astar#date:2019/11/7#正则表达式#作用 >匹配字符串s='hello star'print(s.find('ll'))# 2ret=s.replace('ll','ww')print(ret)#hewwo start=s.split(' ')print(t)#[ 阅读全文
posted @ 2019-11-07 12:10 Stary_tx 阅读(197) 评论(0) 推荐(0) 编辑
摘要: #_author:star#date:2019/11/7# configparser 配置文件模块import configparserconfig=configparser.ConfigParser()# config['DEFAULT']={'ServerAliveInterval':'45', 阅读全文
posted @ 2019-11-07 12:09 Stary_tx 阅读(168) 评论(0) 推荐(0) 编辑
摘要: #_author:star#date:2019/11/6#logger >模块级别的函数#文件与屏幕同时显示日志信息import logginglogger=logging.getLogger()#创建一个Handler,用于写入日志文件fh=logging.FileHandler('logger. 阅读全文
posted @ 2019-11-06 22:35 Stary_tx 阅读(510) 评论(0) 推荐(0) 编辑
摘要: #_author:star#date:2019/11/6#logging 模块import logginglogging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(filename)s [line:%(lineno)d] %(lev 阅读全文
posted @ 2019-11-06 22:33 Stary_tx 阅读(130) 评论(0) 推荐(0) 编辑
摘要: #_author:Administrator#date:2019/11/06#三级菜单(高大上版)#作业要求#1.展示省市县(数据存在文件中)#2.对文件实现增删改with open('menutxt','r',encoding='utf8') as f_read: str_menu=eval(f_ 阅读全文
posted @ 2019-11-06 18:59 Stary_tx 阅读(411) 评论(0) 推荐(0) 编辑
摘要: #_author:star#date:2019/11/5#hashlib模块 >加密import hashlibm=hashlib.md5()print(m)#<md5 HASH object @ 0x00C9A8A8>#'abc'>>>>>>>>>>>>>>>>>>>>>>md5>>>>>>>>> 阅读全文
posted @ 2019-11-06 18:23 Stary_tx 阅读(135) 评论(0) 推荐(0) 编辑