Computer Science, asked by lindassam2006, 6 months ago

What is wrong in my python code?
file=open("‪C:\Users\DELL\Documents\https.docx")
file.read()

Answers

Answered by HozaifaNazarSiddiqui
1

Answer:

u have not specified the mode in which it has to be opened. u must close the file also

right code

file = open('path', 'r')

file.read()

file.close()

I prefer to use this syntax rather than that one,

with file open('path', 'r'):

<tab>file.read()

tab is just 4 spaces

Similar questions