How do you get a file path from repl.it?
How do you get a file path on
I'm guessing that there's some trick I don't know when getting a file path through repl.it. I want to use folders to organize my files, such as the path for a txt file.
import os, sys sys.path.insert(0, 'C:\\some\\path\\goes\\here\\to\\this\\folder')
So what am I missing? I'm guessing it has something to do with the little "(home)/" at the topleft corner of "my repls," but what is it exactly? (And by the way, can you please provide the answer in Python 3? I use that language for everything.)
Thanks in advance!
You can only access files in the same repl unless you make an API or something like that.
@GrantKeo In python you would just do:
myFile = open('filename.txt', 'r')
To open the file 'filename.txt' in read mode (as long as it's in the same folder.
If say filename.txt was in a folder called 'myFolder' and myFolder was in the same folder as the script you are using to reference it, it would be:
myFile = open('myFolder/filename.txt', 'r')
Yeah I was wondering if there was a way to access files inside a repl project. I am doing
os.chdir('mainbank.json') and it says that it is not a directory. I am pretty new to coding with Repl so it would be nice if anyone could help me out. Thanks :D
(home)/ thing is just a way for you to find your repls and I'm quite sure it's just for you to organise your repls which means you can't access stuff from other repls.