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

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top