to_c_cmd.py
Go to the documentation of this file.
1 # place " at begin of each line
2 # escape existing '\' and '"'
3 # remove \n at the end of the line (sometimes the last line does not have a \n
4 # so we cannot do a replacement with some other text)
5 # place an escaped \n and " at the end of each line
6 import sys
7 for line in sys.stdin:
8  sys.stdout.write('"' + line.replace('\\','\\\\').replace('"','\\"').replace('\n','') + '\\n"\n')