Skip to content

Commit ca06ea6

Browse files
committed
python3 compat
1 parent dced78e commit ca06ea6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

marks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sqlite3
2-
import os, tabulate, numpy
2+
import os, tabulate, numpy, six
33
from six import print_
44

55
#Jeremy Reizenstein 2016
@@ -39,7 +39,7 @@ def _getMark(markType, candidate):#candidate must be int
3939
return i[0][0]
4040

4141
def truncate(s, n=10):
42-
if (str==type(s) or unicode == type(s)) and len(s)>n:
42+
if isinstance(s,six.string_types) and len(s)>n:
4343
return s[:n]
4444
return s
4545

@@ -201,7 +201,7 @@ def p(x): print_(x, file=f)
201201
print_(markType,": ",_getMark(markType,candidate),"/", outofs[markType],file=f,sep="")
202202
else:
203203
res = _getMark(markType,candidate)
204-
if(len(unicode(res))>1):
204+
if(len(six.text_type(res))>1):
205205

206206
p(markType)
207207
p(res.encode("iso-8859-1"))

0 commit comments

Comments
 (0)