transferSql.py 488 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. @author: Deepcold
  5. @file: transferSql.py
  6. @time: 2019/9/3 11:39
  7. """
  8. def transfer(content):
  9. if content is None:
  10. return None
  11. else:
  12. string = ""
  13. for c in content:
  14. if c == '"':
  15. string += '\\\"'
  16. elif c == "'":
  17. string += "\\\'"
  18. elif c == "\\":
  19. string += "\\\\"
  20. else:
  21. string += c
  22. return string