1.

Is it possible to create a text file in python?(a) Yes(b) No(c) Machine dependent(d) All of the mentionedI have been asked this question in semester exam.My doubt stems from Files topic in division Regular Expressions and Files of Python

Answer»

The correct choice is (a) YES

Best explanation: Yes we can create a file in PYTHON. Creation of file is as shown below.

file = OPEN(“newfile.txt”, “w”)

file.write(“hello world in the NEW file\n”)

file.write(“and ANOTHER line\n”)

file.close().



Discussion

No Comment Found

Related InterviewSolutions