Reputation: 173
Problem is described below :
a = 535221324694
b = round(a*1,024)
print "number :"+str(b)
>number :5.48066636487e+11
I have tried :
print "number :"+'{0:0f}'.format(b)
>number :548066636487.000000
The result I am looking for is :
>548066636487
Upvotes: 2
Views: 6144
Reputation: 859
you may use:
print "number : {0:.0f}".format(b)
the zero after dot determines how many decimal digits you want after the the decimal mark. :)
extra:
you don't have to combine strings, just write them as one. It is easier to understand later.
Upvotes: 2
Reputation: 107347
You can convert b
to int , then you dont need 0:0f
in format
:
b = int(round(a*1,024))
>>> "number :"+'{}'.format(b)
'number :535221324694'
or as says in comment you may dont need to use format
:
print "number:", int(b)
Upvotes: 1