我有创建sqlite db的当前代码:
import storage
import os
import audiotools
def store_dir(d):
store = storage.HashStore()
for root, bar, files in os.walk(d):
for filename in files:
filename = root + '/' + filename
try:
store.store_file(filename)
print ("Stored %s% filename")
except audiotools.UnsupportedFile:
print ('Skipping unsupported file %s') % filename
except Exception, e:
print (e)
def main():
d = input('Enter the path to the music directory: ')
store_dir(d)
print ("Done.")
if __name__ == '__main__':
main()
当这个代码运行时,我得到一个语法错误消息。请帮帮我! 提前谢谢
这里有几件事需要解决。你知道吗
首先,这条线:
需要这样:
其次,您需要在这里使用^{} :
它返回一个string对象,而不是
input
,后者将输入计算为真正的Python代码。你知道吗第三,你的压痕消失了。我很确定这只是一个格式错误。你知道吗
最后,您应该在这里使用^{} :
这不是一个错误,只是一个提示。你知道吗
总之,您的代码应该如下所示:
相关问题 更多 >
编程相关推荐