summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJulien Balestra <julien.balestra@gmail.com>2015-08-19 21:07:24 +0200
committerJulien Balestra <julien.balestra@gmail.com>2015-08-19 21:07:24 +0200
commitc6f7e7808c30b6890449512e4876efcf55cfa20e (patch)
tree80759a6dc267ac0e2f0b68f79eec776452597972 /examples
parent8abecd0978228c3bb95cdafac73eac849ad3d4ed (diff)
downloadmongo-c6f7e7808c30b6890449512e4876efcf55cfa20e.tar.gz
String format is better than strcat
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/python/ex_stat.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/python/ex_stat.py b/examples/python/ex_stat.py
index f74a78a2651..f1e6c1988dd 100755
--- a/examples/python/ex_stat.py
+++ b/examples/python/ex_stat.py
@@ -75,7 +75,7 @@ def print_overflow_pages(session):
ostatcursor = session.open_cursor("statistics:table:access")
val = ostatcursor[stat.dsrc.btree_overflow]
if val != 0:
- print str(val[0]) + '=' + str(val[1])
+ print '%s=%s' % (str(val[0]), str(val[1]))
ostatcursor.close()
@@ -86,7 +86,7 @@ def print_derived_stats(session):
percent = 0
if file_size != 0:
percent = 100 * ((float(file_size) - float(ckpt_size)) / float(file_size))
- print "Table is %" + str(percent) + " fragmented"
+ print "Table is %%%s fragmented" % str(percent)
app_insert = int(dstatcursor[stat.dsrc.cursor_insert_bytes][1])
app_remove = int(dstatcursor[stat.dsrc.cursor_remove_bytes][1])
@@ -102,7 +102,7 @@ def print_cursor(mycursor):
while mycursor.next() == 0:
val = mycursor.get_value()
if val[1] != '0':
- print str(val[0]) + '=' + str(val[1])
+ print '%s=%s' % (str(val[0]), str(val[1]))
if __name__ == "__main__":
main()