Q. Is it possible to create a text file in python?

  • (A) yes
  • (B) no
  • (C) machine dependent
  • (D) all of the mentioned
πŸ’¬ Discuss
βœ… Correct Answer: (A) yes
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().

Explanation by: Mr. Dubey
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

πŸ“Š Question Analytics

πŸ‘οΈ
860
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
88%
Success Rate