Here is an example that reads a welcome.txt
file line by line and stores it into a list in the welcome_list
variable.
with open('welcome.txt') as f:
welcome_list = f.readlines()
References
- Python docs – Reading and Writing Files
- Methods of File Objects