I have a list of data that needs to be inserted into a single database column. I am getting this error when trying to do it:
sqlite3.InterfaceError: Error binding parameter 4 - probably unsupported type.
That parameter is a list as follows:
['\r\n', ' \n', 'Please let me know if you still need Curve Shift.\n', '\n', 'Thanks,\n', 'Heather\n', ' -----Original Message-----\n', 'From: \tAllen, Phillip K. \n', 'Sent:\tFriday, December 07, 2001 5:14 AM\n', 'To:\tDunton, Heather\n', 'Subject:\tRE: West Position\n', '\n', 'Heather,\n', '\n', 'Did you attach the file to this email?\n', '\n', ' -----Original Message-----\n', ...
(list continues)...
'\n', 'Let me know if you have any questions.\n', '\n', '\n', 'Heather']
I extract part of a text file like so:
def extract_values(f):
lines = f.readlines()
for line_number, line in enumerate(lines):
if line.startswith("X-FileName:"):
data = lines[line_number:] # read from specified line until end of file
break
I'd prefer the data be inserted raw into the table so that it can be read out and enumerated line by line just like a text file. How do I do this? Should I use the blob
type? How should I extract the data differently so it is inserted 'as is' without all the tab and newline codes?