我有一个带有单词列表的txt文件,我想阅读:
我正在使用Python27。
我的代码是:
# Read text file
with open('D:\My_Path.txt', 'r') as fp:
lines = [line.rstrip('\n') for line in fp.readlines()]
time.sleep(10) # does not work well
for line in lines:
print (line)
def AB ():
'''Do something'''
AB ()
答案 0 :(得分:2)
在开头添加import time
,例如time.sleep(.3)
之前的print(line)
。