I found this Perl script while migrating my SQLite database to mysql
I was wondering (since I don\'t know Perl) how could one rewrite this in Python?
Bonus point
Based on http://docs.python.org/dev/howto/regex.html ...
$line =~ /.*/ with re.search(r".*", line).$line !~ /.*/ is just !($line =~ /.*/).$line =~ s/.*/x/g with line=re.sub(r".*", "x", line).$1 through $9 inside re.sub with \1 through \9 respectively.m=re.search(), and replace $1 with the return value of m.group(1)."INSERT INTO $1$2\n" specifically, you can do "INSERT INTO %s%s\n" % (m.group(1), m.group(2)).