Python Forum
Importing data from a text file into an SQLite database with Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Importing data from a text file into an SQLite database with Python
#5
in my previous post, the guys showed me a nice way, but how to load it into a database?

file = 'raport.txt'
 
array = []
with open(file, 'r') as lines:
    for line in lines:
        newlines = line.replace('###', ' ').replace('##', ' ').replace('RANGE', ' ').replace('\n', ' ').split()
        array.append(newlines)
 
    for line in array:
        print(line)
Reply


Messages In This Thread
RE: Importing data from a text file into an SQLite database with Python - by macieju1974 - Jun-29-2020, 07:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Reading an ASCII text file and parsing data... oradba4u 2 100 6 hours ago
Last Post: oradba4u
  wrong entries in sqlite database and tkinter epsilondatum 2 490 Apr-23-2024, 04:48 PM
Last Post: epsilondatum
  need help with data analysing with python and sqlite Hardcool 2 454 Jan-30-2024, 06:49 AM
Last Post: Athi
  Replace a text/word in docx file using Python Devan 4 4,170 Oct-17-2023, 06:03 PM
Last Post: Devan
  python sqlite autoincrement in primary column janeik 6 1,357 Aug-13-2023, 11:22 AM
Last Post: janeik
  save values permanently in python (perhaps not in a text file)? flash77 8 1,383 Jul-07-2023, 05:44 PM
Last Post: flash77
  How to detect abnormal data in big database python vanphuht91 5 1,248 Jun-27-2023, 11:22 PM
Last Post: Skaperen
  Database that can compress a column, or all data, automatically? Calab 3 1,312 May-22-2023, 03:25 AM
Last Post: Calab
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,221 Dec-15-2022, 04:32 PM
Last Post: Larz60+
  New2Python: Help with Importing/Mapping Image Src to Image Code in File CluelessITguy 0 780 Nov-17-2022, 04:46 PM
Last Post: CluelessITguy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020