Python3統計文本中含有空行,中文字符的实际大小 with open(‘one.txt’,‘r’,encoding=‘utf8’,newline=’\r\n’)as f: Str_lenght=len(f.read().encode(‘utf8’))