NIELIT O Level Exam

The syntax used to rename a file :

The syntax used to rename a file :

फ़ाइल का नाम बदलने के लिए प्रयुक्त सिंटैक्स:

A. os.rename(existing_name, new_name)

B. fq.name = ‘new_name.txt’

C. os.rename(fp, new_name)

D. os.set_name(existing_name, new_name)




Correct Answer is :

A. os.rename(existing_name, new_name)



Explanation
os.rename(existing_name, new_name) function is used to rename file. Example: import os os.rename("a.txt","b.txt") hear this code rename the a.txt to b.txt
Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad