And a tiny bug, so I lose. :)
':'.join('{:02X}'.format(b) for b in s)

On Tue, Feb 12, 2019 at 4:52 PM Robert Simmons <rsimmo...@gmail.com> wrote:

> I raise you python 3.6+ using str.format() for best readability.
> ':'.join('{:2X}'.format(b) for b in s)
>
> On Tue, Feb 12, 2019 at 4:18 PM Alexander Nigl <
> python-cryptogra...@qu3.org> wrote:
>
>> I take your
>>
>> > Python 3:
>> > ':'.join('%02x' % b for b in s)
>>
>> and raise you >=Python 3.6
>>
>> ':'.join(f'{b:02X}' for b in s)
>>
>> Sry, had to do it ;)
>>
>> Alexander
>>
>> Ps: 02x is lowercase, 02X uppercase
>> _______________________________________________
>> Cryptography-dev mailing list
>> Cryptography-dev@python.org
>> https://mail.python.org/mailman/listinfo/cryptography-dev
>>
>
_______________________________________________
Cryptography-dev mailing list
Cryptography-dev@python.org
https://mail.python.org/mailman/listinfo/cryptography-dev

Reply via email to