|
From: <lu...@us...> - 2012-09-28 09:20:32
|
Revision: 598
http://pyscard.svn.sourceforge.net/pyscard/?rev=598&view=rev
Author: ludov
Date: 2012-09-28 09:20:26 +0000 (Fri, 28 Sep 2012)
Log Message:
-----------
Add toASCIIString() function
Convert a list of bytes to an ASCII string
Modified Paths:
--------------
trunk/contrib/parseATR/parseATR.py
Modified: trunk/contrib/parseATR/parseATR.py
===================================================================
--- trunk/contrib/parseATR/parseATR.py 2012-09-27 16:41:06 UTC (rev 597)
+++ trunk/contrib/parseATR/parseATR.py 2012-09-28 09:20:26 UTC (rev 598)
@@ -43,6 +43,17 @@
return " ".join(["%02X" % b for b in bytes])
+def toASCIIString(bytes):
+ """ return a string """
+ ascii = ""
+ for b in bytes:
+ if b > 31 and b < 127:
+ ascii += chr(b)
+ else:
+ ascii += '.'
+ return ascii
+
+
def normalize(atr):
""" transform an ATR in list of integers
valid input formats are
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|