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
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad