Simpan baris dari 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
Beautiful Bee