mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-11-06 13:53:02 +03:00
Introduce function for converting bytes list in (hex or int) to string
This function is needed for conversion of bytes list output of TLV parser to representable string Change-Id: I8c1e39ccf9fb517d465e73f69c720e7fdde02ded
This commit is contained in:
1 parent
9837055f4f
commit
7d77d2d5d0
1 file changed
+4
@@ -40,6 +40,10 @@ def h2s(s):
|
||||
def s2h(s):
|
||||
return b2h(s)
|
||||
|
||||
# List of bytes to string
|
||||
def i2s(s):
|
||||
return ''.join([chr(x) for x in s])
|
||||
|
||||
def swap_nibbles(s):
|
||||
return ''.join([x+y for x,y in zip(s[1::2], s[0::2])])
|
||||
|
||||
|
||||
Reference in new issue
Block a user