WebLinuxStudy

导航

 

2019年8月29日

摘要: python判断字符串中是否包含子字符串 s = '1234问沃尔沃434' if s.find('沃尔沃') != -1: print('存在') else: print('不存在') 阅读全文
posted @ 2019-08-29 16:25 WebLinuxStudy 阅读(7177) 评论(0) 推荐(0) 编辑
 
摘要: 逐行读取txt文件 path = r'D:\123456\1.txt'with open(path, 'r', encoding='utf-8') as f: for line in f: value = line[:-1] #去掉换行符 print(value) 阅读全文
posted @ 2019-08-29 16:18 WebLinuxStudy 阅读(5970) 评论(0) 推荐(0) 编辑