From 80f6c97579ab727ad7ec10fbb32e866ae3c7cf0a Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 28 Dec 2020 19:45:28 +0100 Subject: print() is a function in Python 3 --- gen_pot.py | 9 +++++---- gen_tzinfo.py | 17 +++++++++-------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/gen_pot.py b/gen_pot.py index a2358d0..79c4e9d 100644 --- a/gen_pot.py +++ b/gen_pot.py @@ -1,3 +1,4 @@ +from __future__ import print_function import sys import os.path import time @@ -26,12 +27,12 @@ def main(): pot = open(pot_file_name, 'wb') - print >> pot, boilerplate + print(boilerplate, file=pot) for zone in allzones(): - print >> pot, 'msgid "%s"' % zone - print >> pot, 'msgstr ""' - print >> pot + print('msgid "%s"' % zone, file=pot) + print('msgstr ""', file=pot) + print(file=pot) if __name__ == '__main__': diff --git a/gen_tzinfo.py b/gen_tzinfo.py index 02b9d56..0d1c9c8 100644 --- a/gen_tzinfo.py +++ b/gen_tzinfo.py @@ -2,6 +2,7 @@ ''' $Id: gen_tzinfo.py,v 1.21 2005/02/15 20:21:38 zenzen Exp $ ''' +from __future__ import print_function import sys import os import os.path @@ -123,21 +124,21 @@ def add_allzones(filename): cz.append(zone) cz.sort() - print >> outf, 'all_timezones = \\' + print('all_timezones = \\', file=outf) pprint(sorted(allzones()), outf) - print >> outf, '''all_timezones = LazyList( + print('''all_timezones = LazyList( tz for tz in all_timezones if resource_exists(tz)) - ''' - print >> outf, 'all_timezones_set = LazySet(all_timezones)' + ''', file=outf) + print('all_timezones_set = LazySet(all_timezones)', file=outf) # Per lp:1835784 we can't afford to do this at import time # print >> outf, '_all_timezones_lower_to_standard = dict((tz.lower(), tz) for tz in all_timezones)' - print >> outf, 'common_timezones = \\' + print('common_timezones = \\', file=outf) pprint(cz, outf) - print >> outf, '''common_timezones = LazyList( + print('''common_timezones = LazyList( tz for tz in common_timezones if tz in all_timezones) - ''' - print >> outf, 'common_timezones_set = LazySet(common_timezones)' + ''', file=outf) + print('common_timezones_set = LazySet(common_timezones)', file=outf) outf.close() -- cgit v1.2.1