Reading files | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Reading files

How can I define a file in python and can open it ? I mean I want to read a file , but don’t know how to define it ,

19th Apr 2022, 12:52 PM
Angelin
Angelin - avatar
2 Answers
+ 1
You need to provide the full path to the file or change your directory in code using os.chdir() example path: /home/slick/documents/test_file.txt EDIT: Path should be provided as a string
19th Apr 2022, 1:00 PM
Slick
Slick - avatar