说明:字符串存储在txt文件中,首先读取到服务器内存,然后利用count函数计算。
f
= open(r
"long_string.txt",'r')
str1
=f
.read
()
list1
= []
for each
in str1
:
if each
not in list1
:
if each
== '\n':
print('\\n', str1
.count
(each
))
else:
print(each
, str1
.count
(each
))
list1
.append
(each
)
转载请注明原文地址: https://lol.8miu.com/read-750.html