Search found 1 match

by jpvlsmv
Mon Apr 09, 2018 10:35 pm
Forum: General Discussion and Questions
Topic: How to transfer code properly via REPL paste mode?
Replies: 3
Views: 6325

Re: How to transfer code properly via REPL paste mode?

Use Python's raw strings:

ctrl-E
code=r'''(paste)'''
ctrl-D

then save that variable into the target file ( with open('target.py','w') as f: f.write(code) )

It'll transfer everything except nested triple-quoted strings, without additional backslash-escaping.