fix_quotes.py 457 B

123456789101112
  1. import os
  2. os.chdir(os.path.dirname(os.path.abspath(__file__)))
  3. with open('gw_dm.sql', 'r', encoding='utf-8') as f:
  4. content = f.read()
  5. # Fix backslash-escaped single quotes: \' -> ''
  6. content = content.replace("\\'ry\\'", "''ry''")
  7. content = content.replace("\\'", "''")
  8. # Remove any trailing ''; artifacts from earlier sed
  9. content = content.replace("'');''", "'');")
  10. with open('gw_dm.sql', 'w', encoding='utf-8') as f:
  11. f.write(content)
  12. print('Done')