Convert byte string to string.

This commit is contained in:
Matt Guthaus 2018-06-29 15:11:14 -07:00
parent 6cd1779f7b
commit 8d61ccbc6f
1 changed files with 15 additions and 15 deletions

View File

@ -91,14 +91,6 @@ class openram_test(unittest.TestCase):
import re import re
import debug import debug
with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
while True:
b1 = fp1.readline()
b2 = fp2.readline()
#print "b1:",b1,
#print "b2:",b2,
# 1. Find all of the floats using a regex
numeric_const_pattern = r""" numeric_const_pattern = r"""
[-+]? # optional sign [-+]? # optional sign
(?: (?:
@ -110,6 +102,14 @@ class openram_test(unittest.TestCase):
(?: [Ee] [+-]? \d+ ) ? (?: [Ee] [+-]? \d+ ) ?
""" """
rx = re.compile(numeric_const_pattern, re.VERBOSE) rx = re.compile(numeric_const_pattern, re.VERBOSE)
with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
while True:
b1 = fp1.readline().decode('utf-8')
b2 = fp2.readline().decode('utf-8')
#print "b1:",b1,
#print "b2:",b2,
# 1. Find all of the floats using a regex
b1_floats=rx.findall(b1) b1_floats=rx.findall(b1)
b2_floats=rx.findall(b2) b2_floats=rx.findall(b2)
debug.info(3,"b1_floats: "+str(b1_floats)) debug.info(3,"b1_floats: "+str(b1_floats))
@ -117,9 +117,9 @@ class openram_test(unittest.TestCase):
# 2. Remove the floats from the string # 2. Remove the floats from the string
for f in b1_floats: for f in b1_floats:
b1=b1.replace(str(f),"",1) b1=b1.replace(f,"",1)
for f in b2_floats: for f in b2_floats:
b2=b2.replace(str(f),"",1) b2=b2.replace(f,"",1)
#print "b1:",b1, #print "b1:",b1,
#print "b2:",b2, #print "b2:",b2,