+ 2
File operations in code-playground possible?
Hi @ all, I have 2 separate files in code playground which I startet one after the other: . # file1.py with open("info.txt", "w") as fh: word = "How much is the fish?" x = fh.write(word) print(x) . #file2.py with open("info.txt", "r") as fh: word = fh.readlines() print(word) . When running file2.py I get a "file not exist" error. Could You please explain the reason to me? . Many thanks in advance
6 Respuestas
+ 2
Yeah it doesn’t work in code playground I’m pretty sure, you have to download Python IDLE
+ 4
Hmm... perhaps it is still possible to somehow dig into your file if you save it as a code and link through code.sololearn.com... download it, save it as a file and exec() it.
Unless they have the "access denied" policy there ;)
+ 2
Hi Ole,
thank You for Your answer.
I have Python IDLE on my computer and there it works without problems, but I just wanted to try whether CodePlayground is capable of this task, but, regarding to Your response, it seems to be not working on the SL-server.
+ 2
If you first *create* or *download and save* the file, you can operate on it(even run it if it is a script!) in the split-second of the remote Python machine's run.
Take a look:
https://code.sololearn.com/c5f76DBYhYSO/?ref=app
+ 1
Hi Kuba,
thanks for Your response. :-)
That means, what I wanted to do is only possible for a very short timespan.
What I wanted to test was, whether I could write data to a file on SoloLearn, and come back to it days or months later, but this seems to be not possible.