python 格式化字符串的几种方法

Posted on Posted in python

> code

  1. print "%d %s" % (1234,'aaaa')  
  2. print "{} {}".format(1234,'aaa')  
  3. print "{year} {name}".format(year=1234,name="abc")  

Leave a Reply

Your email address will not be published. Required fields are marked *

fourteen + fifteen =