diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2017-12-03 18:47:19 -0800 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2017-12-10 10:51:07 -0800 |
commit | 9de46e416e5ac1be1c5ff170d1c1ada5b8d7278f (patch) | |
tree | 62291426bc36f26ed5ac65d597ed15a5654a4e22 /examples/fetch.py | |
parent | ef64493b8913e4069c4422ad14da6de405c445f6 (diff) | |
download | psycopg2-9de46e416e5ac1be1c5ff170d1c1ada5b8d7278f.tar.gz |
Use print() function instead of print statement throughout project
Forward compatible with newer Pythons.
Diffstat (limited to 'examples/fetch.py')
-rw-r--r-- | examples/fetch.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/fetch.py b/examples/fetch.py index 096a47e..56b00be 100644 --- a/examples/fetch.py +++ b/examples/fetch.py @@ -24,9 +24,9 @@ import psycopg2 if len(sys.argv) > 1: DSN = sys.argv[1] -print "Opening connection using dsn:", DSN +print("Opening connection using dsn:", DSN) conn = psycopg2.connect(DSN) -print "Encoding for this connection is", conn.encoding +print("Encoding for this connection is", conn.encoding) curs = conn.cursor() try: @@ -68,12 +68,12 @@ conn.commit() ncurs = conn.cursor("crs") ncurs.execute("SELECT * FROM test_fetch") -print "First 10 rows:", flatten(ncurs.fetchmany(10)) +print("First 10 rows:", flatten(ncurs.fetchmany(10))) ncurs.scroll(-5) -print "Moved back cursor by 5 rows (to row 5.)" -print "Another 10 rows:", flatten(ncurs.fetchmany(10)) -print "Another one:", list(ncurs.fetchone()) -print "The remaining rows:", flatten(ncurs.fetchall()) +print("Moved back cursor by 5 rows (to row 5.)") +print("Another 10 rows:", flatten(ncurs.fetchmany(10))) +print("Another one:", list(ncurs.fetchone())) +print("The remaining rows:", flatten(ncurs.fetchall())) conn.rollback() curs.execute("DROP TABLE test_fetch") |