Pull Text File From Online Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Pull Text File From Online Python

Is there an easy way/place to store a text file online and then pull that text file into a python code on SoloLearn?

24th Sep 2018, 4:05 AM
Nathan Lewis
Nathan Lewis - avatar
5 Answers
+ 3
I do this in webcodes so I think it will work; I believe there's a "static sites" option but I've also used rawgit.com to obtain public URLs from github.
25th Sep 2018, 12:07 AM
Kirk Schafer
Kirk Schafer - avatar
0
Yeah, don't look at my codes; I invested my time in sockets*. I think there's enough memory for urllib to work now...maybe someone knows... * sockets; not 'simple'
24th Sep 2018, 4:39 AM
Kirk Schafer
Kirk Schafer - avatar
0
I just copied and pasted a 37kb text file into one of my codes as an easy fix😭 still would like to know if anyone has a solution!
24th Sep 2018, 4:42 AM
Nathan Lewis
Nathan Lewis - avatar
0
Huh; I do have a urllib code, just in the wrong direction (but still, I think 'request' is the important bit here): https://code.sololearn.com/cbT8f7dD0t4f/?ref=app Cépagrave has one that pulls in a module file, and note: Python can easily handle compression with builtins (gzip, zlib, etc) https://code.sololearn.com/cfGR3GSuk7yw/?ref=app
24th Sep 2018, 4:51 AM
Kirk Schafer
Kirk Schafer - avatar
0
Okay cool, so if I upload something to github I could pull from there using urllib?
24th Sep 2018, 12:17 PM
Nathan Lewis
Nathan Lewis - avatar