Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

save lines from a file

def get_data_from_text_file(file):

    # declare an empty list for the data
    data = []

    # get the data line-by-line using os.open()
    for line in open(file, encoding="utf8", errors='ignore'):
        # append each line of data to the list
        data += [ str(line) ]    
    # return the list of data
    return data
 
PREVIOUS NEXT
Tagged: #save #lines #file
ADD COMMENT
Topic
Name
6+3 =