Some python syntax that I'm not getting
Laurent Pointal
laurent.pointal at limsi.fr
Fri Dec 7 08:24:49 EST 2007
More information about the Python-list mailing list
Fri Dec 7 08:24:49 EST 2007
- Previous message (by thread): File to dict
- Next message (by thread): Some python syntax that I'm not getting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Chris a écrit : > On Dec 7, 2:31 pm, waltbrad <waltb... at hotmail.com> wrote: >> I understand how D['say'] gets you 5, But I still don't understand >> the line after the 5. >> >> How is the character 's' some special code? And I don't get what is >> going on with the % character. I'm used to it's use in c-style >> formatting, but this just seems so bizarre. I can tell that the key >> is being replaced by it's value in the string, but I don't know how >> that is being done. >> >> TIA > > http://docs.python.org/lib/typesseq-strings.html > > The '%' invokes the formatter, the 's' specifies string type. And the (name) specify to find the value to format (following %s rules) in a dictionnary given as % operator parameter, under the name key.
- Previous message (by thread): File to dict
- Next message (by thread): Some python syntax that I'm not getting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list