【python】极简教程9-实例:单词的读取、检索和索引循环

9.1 读取单词列表

处理文本文件可以通过读取文件中的单词列表开始。在 Python 中,使用 open 函数打开文件,然后逐行读取。

示例代码:

fin = open('words.txt')
for line in fin:
    word = line.strip()
    print

猜你喜欢

转载自blog.csdn.net/weixin_41697242/article/details/143158003