![]() | Ned Batchelder : Blog | Code | Text | Site Python discoveries » Home : Blog : October 2002 |
Python discoveriesSaturday 26 October 2002 I've been using python for a few years now, but I'm still discovering useful tidbits: 1. The encode method on strings. Want to quickly see how a Unicode string comes out in UTF-8?: >>> u"\u201c".encode('utf-8') 2. The % operator (as in sprintf, not modulo) has a named argument syntax (which seems not to be mentioned in the Python Language Reference, but I discovered it in the Python/Perl phrasebook): >>> d = {'a': 1, 'b': 2} | |
Comments
Add a comment: