- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我的 IndentationError 似乎无法解决。 http://pastebin.com/AFdnYcRc .
#!/usr/bin/env python
import os
import glob
import shutil
import mutagen
from sys import exit
musicdir = 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 = False
while 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)
最佳答案
你有一个 try
block (从第 30 行开始)没有 except
关于Python:如何解决 IndentationError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5903739/
我的 IndentationError 似乎无法解决。 http://pastebin.com/AFdnYcRc . #!/usr/bin/env python import os import gl
我正在做 Project Euler编程练习的问题,以便自学。我非常了解如何以数学方式解决问题,以及如何以编程方式解决问题。 但是,我必须想出一些疯狂的代码才能做到这一点; 100 个嵌套循环和 Py
我的缩进有什么问题? >>> try: print("Hello World!") except: File "", line 3 except:
这个问题在这里已经有了答案: SyntaxError inconsistency in Python? (2 个答案) 关闭 5 年前。 首先 - 我对缩进错误的代码没有任何问题,我知道这个异常是如
这个问题已经有答案了: 奥 git _a (6 个回答) 已关闭13 小时前。 我正在 Scrapysplash 上编写一个蜘蛛,我开始收到此错误: File "C:\Users\Name\Pycha
下面是我的全部代码。尝试执行它时,我不断收到错误消息 File "/Users/thomas/prac.py", line 15 elif choice == "1": IndentationEr
这个问题在这里已经有了答案: IndentationError: unindent does not match any outer indentation level (31 个答案) 关闭 2
这个问题在这里已经有了答案: I'm getting an IndentationError. How do I fix it? (6 个答案) 关闭去年。 我有这样的代码 # -*- coding
下面的代码真的让我很烦 我已经查看了 stackoverflow 和谷歌但没有找到任何东西而且我是一个非常好的 pyton 程序员并且到目前为止还没有发现我无法处理的错误.我已经尝试了所有方法,但这种
我有一个简单的问题, IndentationError 是 Python 中的 SyntaxError 吗? 我认为不是,但由于我是初学者,所以我想确定一下。语法错误只是那些给我 SyntaxErro
为什么在下面的程序中引发的是 IndentationError 而不是 SyntaxError? >>> if True: ... print "just right!" File "", lin
python出现"IndentationError: unexpected indent"错误解决办法 Python是一种对缩进非常敏感的语言,最常见的情况是tab和空格的混用
我的程序很简单,我打算制作一个控制台应用程序,在其中可以通过乌龟通过“left_star”,“left_circle” ext之类的命令使用Turtle绘制一些艺术品。当我尝试实现更新时,由于某种原因
这是我的程序,我收到以下提到的错误: def main(): print "hello" if __name__=='__main__': main() 错误 File "hello.py
当我运行以下代码时,它在函数内部有空行(没有空格),在解释器模式和 python3 split.py>> def find(s, start, predictor): ... for i in
这个问题在这里已经有了答案: IndentationError: unindent does not match any outer indentation level (30 个回答) 关闭 4 年
这个问题在这里已经有了答案: I'm getting an IndentationError. How do I fix it? (6 个答案) 关闭 4 年前。 我的 python 代码有问题。我
我使用 Sentinel2 图像并尝试对它们重新采样。 我尝试了以下代码: import os, fnmatch INPUT_FOLDER = "/d/afavro/Bureau/test_resam
我是 Python 的新手,所以请怜悯我。我的环境是: macOS Sierra 10.12.4 and Anaconda 4.3.16 我必须遵循以下代码: import os, import
This question already has answers here: I'm getting an IndentationError. How do I fix it? (4个答案) 5个月
我是一名优秀的程序员,十分优秀!