aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSupreeth Herle <herlesupreeth@gmail.com>2020-05-11 09:07:08 +0200
committerSupreeth Herle <herlesupreeth@gmail.com>2020-05-11 10:39:50 +0200
commit7d77d2d5d01574d242712ad1aa8b8e4ef95fe77b (patch)
tree0db1936b125d66fd5637c8eb6af7fb05dfce6a4d
parent9837055f4f2153732a1006820f84ce439152e918 (diff)
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
-rw-r--r--pySim/utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pySim/utils.py b/pySim/utils.py
index eb7a56b..ee4d2f3 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -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])])