Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79898
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Christian Gollwitzer <auriocus@gmx.de> |
| Newsgroups | comp.lang.python |
| Subject | Re: What does %%(%s)s mean/expand to in Python? What does rowshtml += (rowhtml % ((fieldname, ) * 3)) expand to? Kindly explain. |
| Date | Wed, 29 Oct 2014 09:13:29 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 28 |
| Message-ID | <m2q7j1$a29$1@dont-email.me> (permalink) |
| References | <ee27d38d-8732-485c-a64b-0da2eee1d93b@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Wed, 29 Oct 2014 08:13:21 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="0ca390f552aaaca2fd2a25e51821864b"; logging-data="10313"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/DmhcbHkHmoQX1qedXzhpC2mj8yloxbg=" |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| In-Reply-To | <ee27d38d-8732-485c-a64b-0da2eee1d93b@googlegroups.com> |
| Cancel-Lock | sha1:7ozb2FFvGReB5gi1dVbDcLOgWRs= |
| Xref | csiph.com comp.lang.python:79898 |
Show key headers only | View raw
Am 29.10.14 07:15, schrieb satishmlmlml@gmail.com:
> What does %%(%s)s mean in Python?
Instead of posting all those questions here, you can simply try it in an
interactive python interpreter:
Apfelkiste:VecTcl chris$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> test='%%(%s)s'
>>> test % 'foo'
'%(foo)s'
>>>
> also
> what does
> rowshtml += (rowhtml % ((fieldname,) * 3)) expand to?
>
>>> fieldname='foo'
>>> (fieldname,)*3
('foo', 'foo', 'foo')
>>> test='first %s second %s third %s'
>>> test % ((fieldname,)*3)
'first foo second foo third foo'
>>>
Christian
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
What does %%(%s)s mean/expand to in Python? What does rowshtml += (rowhtml % ((fieldname, ) * 3)) expand to? Kindly explain. satishmlmlml@gmail.com - 2014-10-28 23:15 -0700 Re: What does %%(%s)s mean/expand to in Python? What does rowshtml += (rowhtml % ((fieldname, ) * 3)) expand to? Kindly explain. Peter Otten <__peter__@web.de> - 2014-10-29 08:42 +0100 Re: What does %%(%s)s mean/expand to in Python? What does rowshtml += (rowhtml % ((fieldname, ) * 3)) expand to? Kindly explain. Christian Gollwitzer <auriocus@gmx.de> - 2014-10-29 09:13 +0100
csiph-web