Python 3.x 语法错误I Can';我不明白[Python 3]

Python 3.x 语法错误I Can';我不明白[Python 3],python-3.x,syntax,io,syntax-error,word-wrap,Python 3.x,Syntax,Io,Syntax Error,Word Wrap,这是我的密码: cont = "y" cont1 = "0" cont2 = "yes" log = 0 data = open("songs.txt", "r") songs = data.readlines() songs.sort() while cont1 == "0": cont = input("Do you want to make a playlist? [Y or N]") #Need to change to change cont1 if a playl

这是我的密码:

cont = "y"
cont1 = "0"
cont2 = "yes"
log = 0
data = open("songs.txt", "r")
songs = data.readlines()
songs.sort()


while cont1 == "0":
    cont = input("Do you want to make a playlist? [Y or N]") #Need to change     to change cont1 if a playlist is not wanted to be created
    if cont == "y":
        new = "playlist" + str(log) + ".txt"
        print(new, "Please remember the number. Thanks")
        log = log + 1

else:
    break


while cont == "y":
    print ("1. ", songs[0],"2. ", songs[1],"3. ", songs[2],"4. ", songs[3],"5. ", songs[4],"6. ", songs[5],"7. ", songs[6],"8. ", songs[7],"9. ", songs[8],"10. ", songs[9],"11. ", songs[10],"12. ", songs[11],"13. ", songs[12],"14. ", songs[13],"15. ", songs[14],"16. ", songs[15],"17. ", songs[16],"18. ", songs[17],"19. ", songs[18],"20. ", songs[19])
    choice = int(input("Please enter the first choice of song you would like in your playlist [Type the allocated number please]"))
    choice1 = choice - 1
    with open("playlist" + str(log) + ".txt", "a") as playlist:
            playlist.write(str(songs[choice1]))


    cont = input("Do you want to add another song? [Y or N]")
    if cont == "n":
        break


view = input("Which playlist would you like to view? Please enter the number 
you were given before.")
with open("playlist" + str(view) + ".txt", "a") as see:
    print(see)
我的代码的功能是为使用我已有歌曲的用户提供播放列表生成器。到目前为止,这一切都可以正常工作,但在代码的这一部分中尝试允许用户查看他们选择的播放列表时:

view = input("Which playlist would you like to view? Please enter the number 
you were given before.")
with open("playlist" + str(view) + ".txt", "a") as see:
    print(see)
我收到一条错误消息说:

<_io.TextIOWrapper name='playlist2.txt' mode='a' encoding='UTF-8'>

这对任何人都有意义吗

谢谢


顺便说一下,songs.txt包含20首歌曲的列表。干杯

我想这里可能有几件事
playli2.txt
不是以可读模式打开的,因此
open
需要
r
而不是
a
see
是一个文件对象,因此
print
需要
see.read()
来打印文件内容