Python 3 Start

This commit is contained in:
Luke Rogers 2014-03-06 11:45:00 +13:00
parent 9f029c8ceb
commit 141fe8d80c
67 changed files with 264 additions and 274 deletions

View file

@ -1,5 +1,5 @@
import csv
import StringIO
import io
from util import hook, http, text
@ -29,7 +29,7 @@ def is_number(s):
def unicode_dictreader(utf8_data, **kwargs):
csv_reader = csv.DictReader(utf8_data, **kwargs)
for row in csv_reader:
yield dict([(key.lower(), unicode(value, 'utf-8')) for key, value in row.iteritems()])
yield dict([(key.lower(), str(value, 'utf-8')) for key, value in row.items()])
@hook.command('sc')
@ -66,7 +66,7 @@ def steamcalc(inp, reply=None):
except (http.HTTPError, http.URLError):
return "Could not get data for this user."
csv_data = StringIO.StringIO(request) # we use StringIO because CSV can't read a string
csv_data = io.StringIO(request) # we use StringIO because CSV can't read a string
reader = unicode_dictreader(csv_data)
# put the games in a list