常用鏈接

          統計

          最新評論

          Python study -格式化字符串

          字符串格式化與字符串連接的比較

          >>>count =6
          >>>print "count is %d" % (count,)
          count is 6
          >>>
          print "count is %s" % (count,)
          count is 6
          >>>
          print "count is %f" % (count,)
          count is 6.000000
          >>>
          print "count is %.2f" % (count,)
          count is 6.00
          >>>
          print "count is " +count
          Traceback (most recent call last):
            File "<console>", line 1, in <module>
          TypeError: cannot concatenate 'str' and 'int' objects

          posted on 2009-05-14 11:50 九寶 閱讀(253) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 道孚县| 汕尾市| 墨脱县| 自贡市| 永宁县| 西昌市| 甘孜县| 曲阜市| 南昌县| 石狮市| 台北市| 灌云县| 张家口市| 纳雍县| 金湖县| 桃园市| 长宁区| 定日县| 井陉县| 宿迁市| 福海县| 怀仁县| 海宁市| 元谋县| 泽库县| 安图县| 固阳县| 铜山县| 榆树市| 双鸭山市| 珠海市| 郁南县| 简阳市| 汝阳县| 宾阳县| 黑龙江省| 玉门市| 江油市| 青冈县| 博湖县| 昭觉县|