Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python read string from file

# credit to Stack Overflow user in the source link
# it has been assumed that each line is separated by a '
' character
with open('data.txt', 'r') as file:
    data = file.read().replace('
', ' ')
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #read #string #file
ADD COMMENT
Topic
Name
2+7 =