+ 1
Open a File with Pyton on Sololearn
Sorry, I hope someone could help me. How can I use a file with Pyton on Sololearn app? I think I should load it in a memory space in the web or in the app or something similar, but I don't know how. Thanks!
4 odpowiedzi
+ 2
Sousou thank you but this is what I know. I don't know where the file should be loaded to be opened by the code.
0
If you want to open file using python:
https://code.sololearn.com/cGbrpvGbk8Pn/?ref=app
you can see this;
https://www.w3schools.com/python/python_file_handling.asp
I hope that my answer helps you :)
0
When you open with "a" mode , the write position will always be at the end of the file (an append). There are other permutations of the mode argument for updating (+), truncating (w) and binary (b) mode but starting with just "a" is your best. If you want to seek through the file to find the place where you should insert the line, use 'r+'.
You can also use file access_mode "a+" for Open for reading and writing. The file is created if it does not exist. The stream is positioned at the end of the file . The initial file position for reading is at the beginning of the file, but output is appended to the end of the file.
with open("index.txt", "a+") as myfile:
myfile.write("New text appended")
http://net-informations.com/JUMP_LINK__&&__python__&&__JUMP_LINK/iq/append.htm
0
rahul kumar ,ok. But where is "index.txt"? In my phone? In the web? In which folder?