+ 13
Playground. How to move a file between two, different 🐍 python codes⁉️🤔 [impossible 😕]
I create & close a file in one code & I would like to open & read the same file in another code? Is it possible in SL Playground & how to do this? Both codes are in 🐍 python‼️ CODE1️⃣ CODE2️⃣ f=open('temp_f', 'w') f=open('temp_f', 'r') f.write('something') print(f.read()) f.close() f.close()
16 Réponses
+ 2
No, you should open the file in the same code not in a nother code because this is not allowed in sololearn
+ 6
Every time you start a program on the playground, you start it on a random host. It doesn't know where your made your file previously. It only knows the program you are running now.
+ 5
Muhammad Thanks, I was afraid of that, but I think you are talking about the same code, not the same playground⁉️🤔
For me, it's the worst answer witch I have to mark as the best‼️😕
+ 5
ChaoticDawg Thx, perhaps a cloud-based solution is possible, but I was thinking about storing the temporary file in the local directory of my computer⁉️🤔
+ 5
BroFar Thank you, but I would like to send one, temporary file between two different programs⁉️🤔
Write a second code "using db" that uses the same database created by your first code "creating db"‼️😶
+ 4
Janusz Bujak 🇵🇱
You can't store the file locally to use in 2 seperate programs here on SL (at least within the terms and conditionsof SL), but you can do so using your personal cloud storage. However, this is most likely a bit complicated, and the permission procedure may slightly vary from one cloud host to another. So, you'll have to research for yourself how to accomplish this if it is something you want to pursue further.
+ 4
Paul It's obvious, but tell me how to put the file in the Internet or store it locally on my own computer from SL Playground⁉️🤔
+ 4
Janusz Bujak 🇵🇱
I just did a quick dig though I mentioned it above ..
cited:
"Single-dbs have the advantage of letting application share enterprise data. Exactly as global data is shared by different modules."
reference:
https://softwareengineering.stackexchange.com/questions/378386/one-database-for-multiple-applications
+ 4
It is not possible here.
+ 2
Janusz Bujak 🇵🇱 you should be able to connect back to the database and / or utilize the csv between multiple codes / mini-programs.
+ 2
Janusz Bujak 🇵🇱 It seems like you want to share data between two programs? If then you can use json hosts like https://jsonblob.com/api for that.
Working example 👇
https://code.sololearn.com/crrsMjBY63dX/?ref=app
+ 1
Yes you can get your data from the internet, this is a sample that works for python:
import urllib.request as req
import pandas as pd
import numpy as np
result = req.urlopen('https://people.math.sc.edu/Burkardt/datasets/presidents/president_heights.csv')
data=pd.read_csv(result)
data.sort_values(by=['Name'], inplace=True, ascending=True)
print(data)
+ 1
Janusz Bujak 🇵🇱 I believe you are talking about something like this. I made this like 4 months ago as an example.
https://code.sololearn.com/c0qLqnGRFhhU/?ref=app
+ 1
I think he wants to do it with two sololearn programs, running seperately.
0
Janusz Bujak 🇵🇱 if you noticed I created a database then created a csv file and at the bottom opened and used the csv file
0
Nobody can do this here