Ask coding questions

← Back to all posts
Download file from in run
LovroSindicic (1)

Hy. I writing some project in Python3 and by using run option ( every my classmate can use program without having Python on their mobile phone or computer.
Now I want in access some .txt file that is in my project or even giving option to download directly from run. Option to write all line of file in program is bad because file can have a lot line... any idea?

AlexanderBirabe (101)

You can't download files in a website or even edit them. If you want the website user to see the txt file contents you can do

text = open('filename.txt', 'r')
textLines = text.readlines()
for i in textLines: