Re: [Owfs-developers] Write data with Python3 and pyownet

2020-10-14 Thread Martin Patzak
Maestro Stefano, questo sembra bellissimo! :-) On 14.10.20 16:13, Stefano Miccoli via Owfs-developers wrote: > A more succinct way would be: > > str(x).encode() > > In fact the outer call to ‘bytes’ in 'bytes(str.encode(str(x)))' is a > no-op, and python strings are objects which have an ‘encode'

Re: [Owfs-developers] Write data with Python3 and pyownet

2020-10-14 Thread Mick Sulley
Thanks Stefano, that looks much better. On 14/10/2020 15:13, Stefano Miccoli via Owfs-developers wrote: A more succinct way would be: str(x).encode() In fact the outer call to ‘bytes’ in 'bytes(str.encode(str(x)))' is a no-op, and python strings are objects which have an ‘encode' method, so

Re: [Owfs-developers] Write data with Python3 and pyownet

2020-10-14 Thread Stefano Miccoli via Owfs-developers
A more succinct way would be: str(x).encode() In fact the outer call to ‘bytes’ in 'bytes(str.encode(str(x)))' is a no-op, and python strings are objects which have an ‘encode' method, so no need call the class method ’str.encode’. Another possible way is f"{x:d}".encode() or "{:d}".forma