makecppstring.py (495B)
1 # This Source Code Form is subject to the terms of the Mozilla Public 2 # License, v. 2.0. If a copy of the MPL was not distributed with this 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 4 5 import sys 6 7 8 def main(output, filename): 9 with open(filename) as file: 10 output.write('R"(') # insert literal start 11 for line in file: 12 output.write(line) 13 output.write(')"') # insert literal end 14 15 16 if __name__ == "__main__": 17 main(sys.stdout, sys.argv[1])