Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79916
| From | Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: %%(%s)s mean in python |
| Date | 2014-10-29 16:12 +0100 |
| Organization | A not so newly installed InterNetNews server |
| Message-ID | <m2r05g$5hm$1@r01.glglgl.de> (permalink) |
| References | <76c6409c-5289-4cf2-b80a-6349325356c6@googlegroups.com> |
Am 29.10.2014 07:02 schrieb satishmlmlml@gmail.com:
> What does %%(%s)s mean in Python?
Weird question, as this has nothing to do with the code you just posted.
In general, what comes up to my mind, is that it is a format string to
build another format string.
Example:
metafmt = '%%(%s)s'
fieldname = 'myfield'
fmt = metafmt % fieldname
# Now we have a fmt as if it was assigned with '%(myfield)s':
# %% -> %, %s -> myfield.
d = {fieldname: 'my content'}
print fmt % d
# this now prints the given field - which is noted in fieldname -
# from the given dict d.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
%%(%s)s mean in python satishmlmlml@gmail.com - 2014-10-28 23:02 -0700 Re: %%(%s)s mean in python satishmlmlml@gmail.com - 2014-10-28 23:12 -0700 Re: %%(%s)s mean in python Ned Batchelder <ned@nedbatchelder.com> - 2014-10-29 07:38 -0400 Re: %%(%s)s mean in python Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2014-10-29 16:12 +0100
csiph-web