On 11/08/17 16:10, banda gunda wrote:

> for root, dirs, files in os.walk(".", topdown=False):
>     for name in files:
>         print(os.path.join(root, name))
>         os.rename(name.replace("---", "changed"))

Here you give the new name but not the original name.
The function needs two values, the source(original name)
and the destination(dst)

>         list_of_files[name] = os.sep.join([dirpath, name])

What is dirpath? This is its first mention.

> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call last)
> <ipython-input-6-b679212713d0> in <module>()
> ----> 4         os.rename(name.replace("---", "changed"))
> TypeError: Required argument 'dst' (pos 2) not found

See above

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:

Reply via email to