Movatterモバイル変換
[0]ホーム
[Python-Dev] Strings: '\012' -> '\n'
Tim Peterstim.one@home.com
Tue, 16 Jan 2001 21:04:53 -0500
[Guido]> Good idea [using string.encode()]! This could also be used to> "hexify" a string, for which currently one of the quickest ways> is still the hack>> "%02x"*len(s) % tuple(s)Note that as of 2.0, a far quicker way is to use binascii.b2a_hex(), or itsabsurdist (read "Barry" <wink>) synonym binascii.hexlify().I'm wary of using string.encode() for this, because one normally hexlifiesbinary data (e.g., like sha checksums), and 4 days of 7 we're more than notin favor of moving away from strings to carry binary data.Of course we can change our minds about this across releases, and haveeven-numbered releases deprecate the function forms while odd-numbered onesabjure methods. Works for me <wink>.
[8]ページ先頭