我在运行python3代码时遇到了一些问题。在
这是我面临错误的部分代码。在try:
track_no = int(input("Enter the song number you want to download(0 to download all): "))
resp = input("Do you want to create folder '%s'?(y)" %movie.text)
if resp.strip().lower() in ('y', 'yes'):
dir_path = os.path.join(os.getcwd(), movie.text)
if os.path.isdir(dir_path):
print ("Directory '%s' already exist. Skipping..."%(dir_path))
else:
os.mkdir(dir_path)
else:
dir_path = os.getcwd()
if track_no == 0:
for song in songs:
#call downloader function
download_song(song, dir_path)
else:
download_song(songs[track_no - 1], dir_path)
print ('Download complete')
except (ValueError, IndexError):
print ('Invalid input. Exiting...')
sys.exit(1)
else:
print ("Movie not found")
我面临以下错误。在
^{pr2}$
我是python新手,正在编写一些脚本。请任何人建议我,在我的代码上面的部分是错误的。在