Advertisement
abbarnes

Text File to String List

Sep 27th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. #Add the text file to the visual studio project
  2. try:
  3.     with open('file_name.txt') as f:
  4.         #create list with each line of text as an element
  5.         text = f.read().splitlines()
  6. except FileNotFoundError:
  7.     text = None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement