On Sat, Dec 30, 2017, at 23:57, jf...@ms4.hinet.net wrote:
> I have a multiline string, something like '''...\nf.write('\n')\n...'''
> when pass to exec(), I got
> SyntaxError: EOL while scanning string literal
> 
> How to get rid of it?

Use \\n for this case, since you want the \n to be interpreted by the exec 
parser rather than the newline being part of the string.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to