String format is better than strcat

This commit is contained in:
Julien Balestra
2015-08-19 21:07:24 +02:00
parent 8abecd0978
commit c6f7e7808c

View File

@@ -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()