diff options
author | Ondřej Kuzník <ondra@mistotebe.net> | 2014-12-22 00:52:20 +0100 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2019-12-05 15:06:44 +0100 |
commit | e264eb618b8eabf9670084f40687af916a63567e (patch) | |
tree | 8490b598e6d967f9a453ff7173f6468f8255234e | |
parent | 85f94ee522d9df3d22fc39894dffa2203ea5918b (diff) | |
download | fork-ledger-e264eb618b8eabf9670084f40687af916a63567e.tar.gz fork-ledger-e264eb618b8eabf9670084f40687af916a63567e.tar.bz2 fork-ledger-e264eb618b8eabf9670084f40687af916a63567e.zip |
Use print function
[ci skip]
-rwxr-xr-x | python/demo.py | 6 | ||||
-rw-r--r-- | python/server.py | 14 |
2 files changed, 12 insertions, 8 deletions
diff --git a/python/demo.py b/python/demo.py index 88931b17..e57af05a 100755 --- a/python/demo.py +++ b/python/demo.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +from __future__ import print_function + import sys from datetime import datetime @@ -9,7 +11,7 @@ from datetime import datetime import ledger -print "Welcome to the Ledger.Python demo!" +print("Welcome to the Ledger.Python demo!") # Some quick helper functions to help us assert various types of truth # throughout the script. @@ -290,4 +292,4 @@ assertEqual('$', val.to_amount().commodity.symbol) #journal.collect('-M food') #journal.collect_accounts('^assets ^liab ^equity') -print 'Demo completed successfully.' +print('Demo completed successfully.') diff --git a/python/server.py b/python/server.py index 13182836..7551a092 100644 --- a/python/server.py +++ b/python/server.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +from __future__ import print_function + import ledger import cgi import sys @@ -129,7 +131,7 @@ class LedgerHandler(BaseHTTPRequestHandler): self.wfile.write(html) def do_POST(self): - print "Saw a POST request!" + print("Saw a POST request!") try: ctype, pdict = cgi.parse_header(self.headers.getheader('content-type')) if ctype == 'multipart/form-data': @@ -137,7 +139,7 @@ class LedgerHandler(BaseHTTPRequestHandler): self.send_response(301) self.end_headers() except Exception: - print "Saw exception in POST handler" + print("Saw exception in POST handler") # This code is straight from SimpleHTTPServer.py def copyfile(self, source, outputfile): @@ -182,15 +184,15 @@ def main(*args): try: port = 9000 server = HTTPServer(('', port), LedgerHandler) - print "Local HTTP server listening on port %d... (Control-C to exit)" \ - % port + print("Local HTTP server listening on port %d... (Control-C to exit)" \ + % port) server.serve_forever() except KeyboardInterrupt: - print "Shutting down server" + print("Shutting down server") server.socket.close() if __name__ == '__main__': if len(sys.argv) < 3: - print "usage: server.py <DATA-FILE> <REPORT-QUERY>" + print("usage: server.py <DATA-FILE> <REPORT-QUERY>") sys.exit(1) main() |