Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 27f731d

Browse files
author
cclauss
authored
Make examples compatible with Python 3
https://docs.python.org/3/whatsnew/3.0.html
1 parent 4a11c70 commit 27f731d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/getting_started.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ Connecting with a client
5656
5757
# Perform client tasks...
5858
session = client.session()
59-
print 'Username: {0}'.format(session['userCtx']['name'])
60-
print 'Databases: {0}'.format(client.all_dbs())
59+
print('Username: {0}'.format(session['userCtx']['name']))
60+
print('Databases: {0}'.format(client.all_dbs()))
6161
6262
# Disconnect from the server
6363
client.disconnect()
@@ -176,7 +176,7 @@ Creating a database
176176
177177
# You can check that the database exists
178178
if my_database.exists():
179-
print 'SUCCESS!!'
179+
print('SUCCESS!!')
180180
181181
Opening a database
182182
^^^^^^^^^^^^^^^^^^
@@ -228,7 +228,7 @@ Creating a document
228228
229229
# Check that the document exists in the database
230230
if my_document.exists():
231-
print 'SUCCESS!!'
231+
print('SUCCESS!!')
232232
233233
Retrieving a document
234234
^^^^^^^^^^^^^^^^^^^^^
@@ -244,7 +244,7 @@ classes are sub-classes of ``dict``, this is accomplished through standard
244244
my_document = my_database['julia30']
245245
246246
# Display the document
247-
print my_document
247+
print(my_document)
248248
249249
Retrieve all documents
250250
^^^^^^^^^^^^^^^^^^^^^^
@@ -256,7 +256,7 @@ to retrieve all documents in a database.
256256
257257
# Get all of the documents from my_database
258258
for document in my_database:
259-
print document
259+
print(document)
260260
261261
Update a document
262262
^^^^^^^^^^^^^^^^^
@@ -333,7 +333,7 @@ object already exists.
333333
334334
# Iterate over the result collection
335335
for result in result_collection:
336-
print result
336+
print(result)
337337
338338
****************
339339
Context managers
@@ -367,13 +367,13 @@ and ``couchdb_admin_party`` context helpers.
367367
368368
# Perform client tasks...
369369
session = client.session()
370-
print 'Username: {0}'.format(session['userCtx']['name'])
371-
print 'Databases: {0}'.format(client.all_dbs())
370+
print('Username: {0}'.format(session['userCtx']['name']))
371+
print('Databases: {0}'.format(client.all_dbs()))
372372
373373
# Create a database
374374
my_database = client.create_database('my_database')
375375
if my_database.exists():
376-
print 'SUCCESS!!'
376+
print('SUCCESS!!')
377377
378378
# You can open an existing database
379379
del my_database
@@ -387,12 +387,12 @@ and ``couchdb_admin_party`` context helpers.
387387
doc['pets'] = ['cat', 'dog', 'frog']
388388
389389
# Display a Document
390-
print my_database['julia30']
390+
print(my_database['julia30'])
391391
392392
# Delete the database
393393
client.delete_database('my_database')
394394
395-
print 'Databases: {0}'.format(client.all_dbs())
395+
print('Databases: {0}'.format(client.all_dbs()))
396396
397397
****************
398398
Endpoint access
@@ -422,4 +422,4 @@ Cloudant/CouchDB server. This example assumes that either a ``Cloudant`` or a
422422
response = client.r_session.get(end_point, params=params)
423423
424424
# Display the response content
425-
print response.json()
425+
print(response.json())

0 commit comments

Comments
 (0)