Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python read line into list

with open("data_file.txt") as f:
    content_list = f.readlines()

# print the list
print(content_list)

# remove new line characters
content_list = [x.strip() for x in content_list]
print(content_list)
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #python #read #line #list
ADD COMMENT
Topic
Name
3+9 =