diff options
Diffstat (limited to 'Doc/library/itertools.rst')
-rw-r--r-- | Doc/library/itertools.rst | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index d7a7668..d6e3291 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -385,7 +385,7 @@ can be combined. :: >>> amounts = [120.15, 764.05, 823.14] >>> for checknum, amount in izip(count(1200), amounts): - ... print 'Check %d is for $%.2f' % (checknum, amount) + ... print('Check %d is for $%.2f' % (checknum, amount)) ... Check 1200 is for $120.15 Check 1201 is for $764.05 @@ -393,7 +393,7 @@ can be combined. :: >>> import operator >>> for cube in imap(operator.pow, range(1,5), repeat(3)): - ... print cube + ... print(cube) ... 1 8 @@ -403,7 +403,7 @@ can be combined. :: >>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura', ... '', 'martin', '', 'walter', '', 'mark'] >>> for name in islice(reportlines, 3, None, 2): - ... print name.title() + ... print(name.title()) ... Alex Laura @@ -416,7 +416,7 @@ can be combined. :: >>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) >>> di = sorted(d.iteritems(), key=itemgetter(1)) >>> for k, g in groupby(di, key=itemgetter(1)): - ... print k, map(itemgetter(0), g) + ... print(k, map(itemgetter(0), g)) ... 1 ['a', 'c', 'e'] 2 ['b', 'd', 'f'] @@ -427,7 +427,7 @@ can be combined. :: # same group. >>> data = [ 1, 4,5,6, 10, 15,16,17,18, 22, 25,26,27,28] >>> for k, g in groupby(enumerate(data), lambda t:t[0]-t[1]): - ... print map(operator.itemgetter(1), g) + ... print(map(operator.itemgetter(1), g)) ... [1] [4, 5, 6] |