Python编写方法统计文档中总单词数 代码: def count_words(file_name): ''' 方法:统计file_name中总词数 ''' try: with open(file_name,encoding='utf-8') as file_object: message = file_o