def count_character(name):
with open(name, 'r', encoding='utf-8') as data:
string_get = data.read().strip()
check_string = ",。?!@#¥%……&*;(:; ) ——+|、·:“”’‘\n"
for i in check_string:
if i in string_get:
string_get = string_get.replace(i, '')
# print(string_get)
return len(string_get)
file_name = input()
print(count_character(file_name))
05-24
2385
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)