adplus-dvertising
frame-decoration

Question

How do you rename a file?

a.

fp.name = ‘new_name.txt’

b.

os.rename(existing_name, new_name)

c.

os.rename(fp, new_name)

d.

os.set_name(existing_name, new_name)

Posted under Python

Answer: (b).os.rename(existing_name, new_name)

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. How do you rename a file?