Roy Smith wrote: > In article <72a7dd52-7619-4520-991e-20db7ce55...@googlegroups.com>, > Sam <lightai...@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'''
PMFJI. When I asked (here) about this a while ago, some kind soul suggested textwrap.dedent. Any advice as to the pros and cons of the respective approaches (esp. for SQL)? -- https://mail.python.org/mailman/listinfo/python-list