你只是打开了而已,还没读取内容
试试这个代码,可以读取出来
with open("P.txt", 'r', encoding='utf-8') as f: for line in f.readlines(): print(line)