Write a program that opens an output file with the filename

Write a program that opens an output file with the filename my_name.txt, write your name to the file and then closes the file. (Please include a show of exactly how it would appear in Python)

Solution

file = open(\'my_name.txt\', \'w\')
file.write(\"Sekhar Murapaka\")
file.close()

Output:

my_name.txt contains Sekhar Murapaka

Write a program that opens an output file with the filename my_name.txt, write your name to the file and then closes the file. (Please include a show of exactly

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site