Advertisement
Guest User

Untitled

a guest
Mar 6th, 2012
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. input = open('svebaze.sql', 'r')
  2. current_file = None
  3. for line in input:
  4.     if line.startswith("USE '"):
  5.         if current_file:
  6.             current_file.close()
  7.         output_filename = "db_%s.sql" % (line.split("'")[1],)
  8.         current_file = open(output_filename, 'w')
  9.     else:
  10.         current_file.write(line)
  11. current_file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement