Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65679

Re: What does """ means in python?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!panix!roy
From Roy Smith <roy@panix.com>
Newsgroups comp.lang.python
Subject Re: What does """ means in python?
Date Sat, 08 Feb 2014 09:08:09 -0500
Organization PANIX Public Access Internet and UNIX, NYC
Lines 22
Message-ID <roy-C8B893.09080908022014@news.panix.com> (permalink)
References <72a7dd52-7619-4520-991e-20db7ce55ba3@googlegroups.com>
NNTP-Posting-Host localhost
X-Trace reader1.panix.com 1391868489 9229 127.0.0.1 (8 Feb 2014 14:08:09 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Sat, 8 Feb 2014 14:08:09 +0000 (UTC)
User-Agent MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)
Xref csiph.com comp.lang.python:65679

Show key headers only | View raw


In article <72a7dd52-7619-4520-991e-20db7ce55ba3@googlegroups.com>,
 Sam <lightaiyee@gmail.com> wrote:

> For string, one uses "" to represent string. Below is a code fragment that 
> uses """ instead.
> 
> cursor.execute("""SELECT name, phone_number 
>                   FROM coworkers 
>                   WHERE name=%s 
>                   AND clue > %s 
>                   LIMIT 5""",
>                (name, clue_threshold))
> 
> What does """ means in python?

This is what's known as a "triple quoted string"  It's just like a 
regular string, except that it run across newlines.  Very handy for 
things like embedding SQL code in a Python program!

It works with single quotes too (i.e. '''this is
a very long string
spread out over several lines'''

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

What does """ means in python? Sam <lightaiyee@gmail.com> - 2014-02-08 06:02 -0800
  Re: What does """ means in python? Roy Smith <roy@panix.com> - 2014-02-08 09:08 -0500
    Re: What does """ means in python? Walter Hurry <walterhurry@gmail.com> - 2014-02-08 19:55 +0000
      Re: What does """ means in python? Chris Angelico <rosuav@gmail.com> - 2014-02-09 08:40 +1100
      Vedr: What does """ means in python? Gisle Vanem <gvanem@yahoo.no> - 2014-02-09 05:49 +0000
        Re: Vedr: What does """ means in python? Duncan Booth <duncan.booth@invalid.invalid> - 2014-02-10 10:50 +0000

csiph-web