Skip to content

Commit

Permalink
fixed print & has_key errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sierret committed Jun 13, 2020
1 parent 40e2007 commit 602e1c8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ def register_mode(mode_class):
mode.output(mode.execute())

except Exception as ex:
print ex
print(ex)
2 changes: 1 addition & 1 deletion classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ def execute(self):
return result

def output(self, result):
print 'Probability that document is %s rather than %s is %1.2f' % (self.doctype1, self.doctype2, result)
print('Probability that document is %s rather than %s is %1.2f' % (self.doctype1, self.doctype2, result))
2 changes: 1 addition & 1 deletion db.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def update_doctype_count(self, num_new_ads, doctype):
c = self.conn.cursor()
try:
counts = self.get_doctype_counts()
if counts.has_key(doctype):
if (doctype) in counts:
current_count = counts[doctype]
else:
current_count = 0
Expand Down
2 changes: 1 addition & 1 deletion learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ def execute(self):
return self.count

def output(self, _):
print "Processed %s documents of type '%s'" % (self.count, self.doc_type)
print("Processed %s documents of type '%s'" % (self.count, self.doc_type))
2 changes: 1 addition & 1 deletion reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ def execute(self):
Status().execute()

def output(self, _):
print 'Reset Complete'
print('Reset Complete')
8 changes: 4 additions & 4 deletions status.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ def execute(self):

def output(self, results):
bar = '=' * 40
print '%s\nStatus:\n%s\n' % (bar, bar)
print('%s\nStatus:\n%s\n' % (bar, bar))

if results:
for doctype, count in results:
print '%s: %s' % (doctype, count)
print('%s: %s' % (doctype, count))
else:
print 'No data'
print('No data')

print '\n%s' % bar
print('\n%s' % bar)

0 comments on commit 602e1c8

Please sign in to comment.