I just started to learn python. I am getting the following error.
a=15/737
print("String formating with value{r.1.4f}".format(r=a))
AttributeError Traceback (most recent call last) in ---- > 1 print ( "string formating with value {r.1.4f}". format ( r = a ) )
AttributeError: 'float' object has no attribute '1
Can anyone tell me what is worng here?
It's a just syntax error:
Put a colon (:) behind r instead of a point(.) and it will work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.