Q: quoting string without escapes

S

Steve Holden

Xah said:
in Python, is there a way to quote a string as to avoid escaping ' or "
inside the string?

i.e. like Perl's q or qq.
thanks.

Xah
(e-mail address removed)
http://xahlee.org/PageTwo_dir/more.html
Aren't you the guy who's telling the whole world how to write Python and
Perl? Unusual to find arrogance and humility in such close proximity.

Please stop cross-posting your ill-informed and inflammatory stuff to
c.l.py and c.l.perl.m. And now I have your attention, the answer to your
question is ...

Use triple-quoting.

followups-set'ly y'rs - steve
 
D

Daniel Bickett

Use triple-quoting.

An example, for the sake of examples:

Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information..... "
.... "
.... "
.... '
.... '
.... '
.... \"""
.... "\""
.... ""\"
.... """'\n"\n"\n"\n\'\n\'\n\'\n"""\n"""\n"""\n'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top