摘要: #文件名 # apple 12 2 # fhal 34 1 # fsdh 45 5 # fjff 2000 6 # ddd 10 3 # with open('aaa.txt',encoding='utf-8',mode='r') as f1: # lis = [] # for line in f1 阅读全文
posted @ 2020-03-28 20:41 河马哥 阅读(355) 评论(0) 推荐(0) 编辑
摘要: 问题: 过滤用户输入中前后多余的空白字符 ‘ ++++abc123 ‘ 过滤某windows下编辑文本中的'\r': ‘hello world \r\n' 去掉文本中unicode组合字符,音调 "Zhào Qián Sūn Lǐ Zhōu Wú Zhèng Wáng" 如何解决以上问题? 去掉两端 阅读全文
posted @ 2020-03-28 19:15 河马哥 阅读(4457) 评论(0) 推荐(0) 编辑
摘要: cars = ['鲁A32444','鲁B12333','京B8989M','黑C49678','黑C46555','沪 B25041'] locals = {'沪':'上海','黑':'黑龙江','鲁':'山东','鄂':'湖北','湘':'湖南','京':'北京&# 阅读全文
posted @ 2020-03-28 16:51 河马哥 阅读(551) 评论(0) 推荐(0) 编辑
摘要: #把列表中所有周姓的人的信息删掉 lst = ['周老二','周星星','麻花藤','周扒皮','大周'] li = [] for i in lst: if i.strip()[0] != '周': li.append(i) lst = li print(lst) #倒序 lst = ['周老二', 阅读全文
posted @ 2020-03-28 13:25 河马哥 阅读(188) 评论(0) 推荐(0) 编辑
摘要: while 1: num = input('请输入一个三位数:') count = 0 if num.isdecimal() and 100 <= int(num) < 1000: for i in num: count = count + int(i) ** 3 if count == int(n 阅读全文
posted @ 2020-03-28 13:18 河马哥 阅读(342) 评论(0) 推荐(0) 编辑