程序:
def main():
#读取文件
f = open('C:/Users/Administrator/Desktop/password3.0.txt', 'r')
# #1.read()
# content=f.read()
# print(content)
# # 2.readline()
# line = f.readline()
# print(line)
# 3.readlines()
for line in f.readlines():
print('read:{}'.format(line))
f.close()
if __name__=='__main__':
main()
运行结果: