Re: How to exec a string which has an embedded '\n'? (Posting On Python-List Prohibited)

2017-12-31 Thread jfong
Lawrence D’Oliveiro於 2018年1月1日星期一 UTC+8上午7時56分02秒寫道: > On Sunday, December 31, 2017 at 11:04:19 PM UTC+13, jf...@ms4.hinet.net wrote: > > > > This answer makes me think about '\' more thoughtful:-) > > Python generating HTML containing JavaScript which generates HTML: > > out.write \ >

Re: How to exec a string which has an embedded '\n'?

2017-12-31 Thread jfong
Random832於 2017年12月31日星期日 UTC+8下午1時25分50秒寫道: > 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? >

Re: How to exec a string which has an embedded '\n'?

2017-12-30 Thread Random832
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

How to exec a string which has an embedded '\n'?

2017-12-30 Thread jfong
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? Best Regards, Jach Fong -- https://mail.python.org/mailman/listinfo/python-list