I cant open file .If I run this code open('abc.txt') ,output error " such no file ..." .But I put the file abc in same folder. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I cant open file .If I run this code open('abc.txt') ,output error " such no file ..." .But I put the file abc in same folder.

tell me please

6th Dec 2016, 6:45 AM
Rick.T.Diar
3 Answers
+ 3
e.g. file = open ('abc.txt', 'r') print (file.read ())
6th Dec 2016, 11:22 AM
THDevelop
THDevelop - avatar
+ 2
Check the file name again. are you sure it is a txt file ?
6th Dec 2016, 11:17 AM
Binara Sachin
+ 2
set the path include the txt file. eg. c:/temp/abc.txt and asvwhat you want read or write.
6th Dec 2016, 11:20 AM
THDevelop
THDevelop - avatar