2018年11月8日

python列表(list)遍历

摘要: list = ['html', 'js', 'css', 'python'] 遍历列表方法1:for i in list: print("序号:%s 值:%s" % (list.index(i) + 1, i)) 遍历列表方法2:for i in range(len(list)): print("序 阅读全文

posted @ 2018-11-08 14:03 kingofyz 阅读(3083) 评论(0) 推荐(0)

python去除\ufeff、\xa0、\u3000

摘要: 今天使用python处理一个txt文件的时候,遇到几个特殊字符:\ufeff、\xa0、\u3000,记录一下处理方法 代码:with open(file_path, mode='r') as f: s = f.read() 1.\ufeff 字节顺序标记 去掉\ufeff,只需改一下编码就行,把U 阅读全文

posted @ 2018-11-08 12:01 kingofyz 阅读(20599) 评论(0) 推荐(3)

导航