Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How to access any file in a python 3.7 program?

+1 vote
asked Jun 7, 2019 by SatyoJena (200 points)
any file means audio, video, text ,jpg etc

1 Answer

+1 vote
answered Jun 8, 2019 by Akshay Singh
python_variable_name = open("Location_of_the_file\filename.type",'mode_of_file')

python_variable_name.close()

Explanation: Here python_variable_name can be any user given variable name

                     type can be file type e.g.  Text File = .txt ,Doc File = .doc etc

                    mode_of_file can be 'w' for writing mode,'r' for reading mode , 'a' for append mode
commented Jun 12, 2019 by SatyoJena (200 points)
thanks that was helpful.

but can i access video and jpg files through this.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...