http://pastebin.com/AFdnYcRc.
#!/usr/bin/env pythonimport osimport globimport shutilimport mutagenfrom sys import exitmusicdir = raw_input("What directory are the music files located in? : ")musfile = glob.glob(musicdir + '/' + "*.mp3")musfile1 = glob.glob(musicdir + '/' + "*.flac")musfile.extend(musfile1)newmusicdir = raw_input("What directory should the music files be organized into? : ")done = Falsewhile not done: for m in musfile: if musfile: try: musta = mutagen.file(m,easy=True) mar = str(musta['artist'][0]) mal = str(musta['album'][0]) mti = str(musta['Title'][0]) mtr = str(musta['tracknumber'][0]) os.makedirs(newmusicdir + '/' + mar + '/' + mal + '/') except OSError: pass finally: try: if m.endswith('.mp3'): os.rename(m,mtr + ' - ' + mar + ' - ' + mti + '.mp3') m =mtr + ' - ' + mar + ' - ' + mti + '.mp3' shutil.move(m,newmusicdir + '/' + mar + '/' + mal + '/') elif m.endswith('.flac'): os.rename(m,mtr + ' - ' + mar + ' - ' + mti + '.flac') m = mtr + ' - ' + mar + ' - ' + mti + '.flac' shutil.move(m,newmusicdir + '/' + mar + '/' + mal + '/') elif not musfile: print "Looks like we're done here. Please press <enter> to exit" raw_input() sys.exit(0)解决方法 第二次尝试我没有看到一个除了块.这应该打破它,但我不认为它会给你一个IndendationError,所以你可能会有更多的问题. 总结
以上是内存溢出为你收集整理的Python:如何解决IndentationError全部内容,希望文章能够帮你解决Python:如何解决IndentationError所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)