Python:如何解决IndentationError

Python:如何解决IndentationError,第1张

概述我的IndentationError看起来似乎无法解决. http://pastebin.com/AFdnYcRc. #!/usr/bin/env pythonimport osimport globimport shutilimport mutagenfrom sys import exitmusicdir = raw_input("What directory are the m 我的IndentationError看起来似乎无法解决.
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所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1195890.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-03
下一篇 2022-06-03

发表评论

登录后才能评论

评论列表(0条)

保存