Python Sqlite3 DB c.exec data LIKE "..." header advice

37 Views Asked by At
#!/usr/bin/python

import os
import os.path
import sqlite3
import argparse
...

...
c = conn.cursor()

c.execute('SELECT hash, data FROM blobs WHERE data LIKE "OggS%"')
...

...
conn.close()

...

This is code to extract a data with the header of OggS% from a sqlite database (obviously). My question is how do I make it work for various other file types and how do I get headers of various more abstract files and properly insert them there? I've tried a few things like hex strings but they didn't work out. Also a complete newbie when it comes to Python so clear examples would be appreciated.

0

There are 0 best solutions below