I want to get user input path and use it as a variable. But still struggle to use it right way. I put root variable for error_log creation in the folder by User input.
root = input("Enter path to music folder: ")
for root, dirs, files in os.walk(root):
for name in files:
if name.lower().endswith(".mp3"):
try:
os.rename(os.path.join(root,name), os.path.join(root,name.replace("_"," ").replace(".MP3",".mp3")))
except:
with open(r"root\Error_mp3_log.txt","a", encoding='UTF-8') as w:
w.write(os.path.join(root, name, "\n"))
w.write('\n')