做题时遇到大量字符串怎么办??

利用 collection 模块简化代码

from collections import Counter
with open("flag.txt") as f:
	text_list = f.readlines()
	'''将读取的内容转换为字符串'''
	text_str = ''.join(text_list)
	count = Counter(text_str)
	print (count)
更新于

请我喝[茶]~( ̄▽ ̄)~*

1sme 微信支付

微信支付