0
Opening files in the phone
How do I open the txt file in the phone? Write me a full example (note that I'm not opening from sd)
20 odpowiedzi
+ 3
Well in that case;
If the file is in the same folder as python files than just specify the file extension. e.g open(test.txt)
else if it is in some other directory
specify the directory path of the file (check the file path using file explorer)
e.g open(storage/sdcard0/test.txt)
+ 1
Assuming you are on Android(lollipop and higher)
1. open default file explorer app.
2. select internal storage option if available any/ else skip this.
3. go to the storage/sdcard0(Android devices without sdcards have a portion of internal storage as partition for sdcard).
4. click on the txt file; if you have an txt editor app it should show as an option to open with.(download text editor app if you don't have one)
+ 1
use the same method as above
e.g open(storage/sdcard0/python.py) should work.
+ 1
did you create a file with the extension .py and specify correct file name e.g test.py
+ 1
remove the text.txt and include your python script file name if it is python.py then
e.g (storage/sdcard0/python/python.py)
+ 1
What app are you using ?
did you try that this way with quotes?('storage/sdcard0/python/python.py')
+ 1
Specify the app & the whole method you used; then I can try to help to the best of my abilites, if you need any help.
0
stop. i want open files in the python like this
open('C:...','...')
0
It's good. I have one more question. How do I run a file (the program .py) in the compiler by calling it in the directory
0
dont work please help me
0
this does not work. He writes that there is no directory or a file with that name does not exist
0
i writed
('storage/sdcard0/Python/text.txt','r')
0
error : storage is not defined
0
yeee man
0
i like you
0
how friend
0
why? all working
0
men, i have a one problem
0
look
i have writed:
f=open('storage\sdcard0\Python\text.txt','r')
error:
Traceback (most recent call last):
File "source_file.py", line 1, in <module>
f=open('storage\sdcard0\Python\text.txt','r')
IOError: [Errno 2] No such file or directory: 'storage\\sdcard0\\Python\text.txt'
0
my app:
Dcoder
(from play market)