5 thoughts on “Udacity – Programming Fundamentals with Python – Rename File”

  1. i copied the above code and ran it using my own dir string on my own computer. after the 3 =’s is the red script that is returned.

    =

    Traceback (most recent call last):
    File “C:/Users/owner/Desktop/Udacity/Python projects/Lesson 5.21/test run from github rename files.py”, line 20, in
    rename_files()
    File “C:/Users/owner/Desktop/Udacity/Python projects/Lesson 5.21/test run from github rename files.py”, line 15, in rename_files
    print(“New Name: “+file_name.translate(None, “0123456789”))
    TypeError: translate() takes exactly one argument (2 given)

    >

  2. Note the only thing i changed from the Copy and Paste method is the C:url string.

    from the one used in the above code to the one that is on my specific
    to my computer.

  3. I have used the same code and received this message:

    print(“New Name: “+file_name.translate(None, “0123456789”))
    TypeError: translate() takes exactly one argument (2 given)

    I removed the ‘None’ and the code runs, but the numeric values are not removed.
    Sarah

Comments are closed.