摘要: 一、生成器表达式 统计文件中字符的个数: #a.txt # hello # world with open('a.txt',mode='rt',encoding='utf-8') as f: res = sum(len(line) for line in f) print(res) 会得到11,其中 阅读全文
posted @ 2018-12-04 20:12 Iron-Mam 阅读(267) 评论(0) 推荐(0) 编辑