Python format 格式化函數

之前一直用%,之後要養成用強大format的習慣:html Python2.6 開始,新增了一種格式化字符串的函數 str.format(),它加強了字符串格式化的功能。python 基本語法是經過 {} 和 : 來代替之前的 % ide format 函數能夠接受不限個參數,位置能夠不按順序。 實例 >>>"{} {}".format("hello", "world")    # 不設置指定位置
相關文章
相關標籤/搜索