[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v20210701 06/40] tools: fix Python3.4 TypeError in format string



Am Fri, 2 Jul 2021 18:19:39 +0200
schrieb Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>:

> Why bytes()? Encode does already return bytes type.

You are right, this works as well:
  i = 123
  b = ("str/%x" % (i, )).encode('utf-8')

Any preference regarding the "encoding"? I picked UTF8, but 'ascii' might be 
more correct in this context. In practice it may not matter.


Olaf

Attachment: pgp7AGa548_ZR.pgp
Description: Digitale Signatur von OpenPGP


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.