python - populate table where each column comes from a different line of a text file -
I have a txt file where some lines contain strings and some other rows have a value. According to the values "related" are the last line. For example: + aaa '+' bbb '* value 1 * value 2 +' ccc '* value 3 +' ddd ' etc. . I am trying to create a table where the first column is wired and in the second column there are rows in which there are values. My problem is that if I consider the value of the string, then the string and value (list) must be on the same line. If there is no related value of the string, then I want to put it in the same line with NULL. Something like this: Column 1 | Column 2 ----------------------------- + 'aaa' | Tap + 'BBB' | [* Value1, * value2] + 'ccc' | [* Value 3] + 'Deed' | NULL etc. I tried to do something like this: import sqlite3db = sqlite3.connect ('mydatabase.db') cur = db.cursor ('Myfile.txt') as opened (): ():. () '' For line for f.readlin...