Kumar :
I am using python2 for printing some data. I am looking to print the output in the following format.
echo 'Stats,tableName=test ItemCount=1,TableSizeBytes=85'
With my code it is giving in the below format. Any Help would be appreciated.
Ouput:
echo Stats tableName= test ItemCount= 1 TableSizeBytes= 85
Code:
from __future__ import print_function
import boto.dynamodb
import boto
for table in lts:
tableinfo = conn.describe_table(table)
TableName = tableinfo['Table']['TableName']
ItemCount = tableinfo['Table']['ItemCount']
TableSize = tableinfo['Table']['TableSizeBytes']
print('echo','Dynamostats','TableName=',TableName,'ItemCount=',ItemCount,'TableSizeBytes=',TableSize)
Prashant Kumar :
Try this :
print("echo 'Stats,tableName={0} ItemCount={1},TableSizeBytes={2}'".format(TableName, ItemCount, TableSize))
Output :
>>>"echo 'Stats,tableName=test ItemCount=1,TableSizeBytes=85'"
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=387159&siteId=1