File handling DS301222

text=input("enter the text ")

file= open(‘myfile.txt’, ‘w’)

file.write(text)

2 Likes

You need to close the file using " close " or you need to use " With " @DEVANSHUBISHT66

text=input("enter the text ")
with open(‘hifile.txt’, ‘w’) as filehndl:
filehndl.write(text)

1 Like

Good @DEVANSHUBISHT66