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


Groups > comp.lang.python > #79898

Re: What does %%(%s)s mean/expand to in Python? What does rowshtml += (rowhtml % ((fieldname, ) * 3)) expand to? Kindly explain.

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 2014-10-29 09:13 +0100
Organization A noiseless patient Spider
Message-ID <m2q7j1$a29$1@dont-email.me> (permalink)
References <ee27d38d-8732-485c-a64b-0da2eee1d93b@googlegroups.com>

Show all headers | 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


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