读取txt文件.py

"""
read():读取整个文件。
readline():读取一行数据。
readlines():读取所有行的数据。
"""
user_file = open("user_info","r")
lines = user_file.readlines()
user_file.close()
for line in lines:
username = line.split(",")[0]
password = line.split(",")[1]
print(username,password)
posted @ 2020-01-18 22:46  干it的小张  阅读(265)  评论(0编辑  收藏  举报