常用鏈接

          統計

          最新評論

          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 九寶 閱讀(254) 評論(0)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 松原市| 长春市| 普定县| 兰溪市| 和林格尔县| 万州区| 浦江县| 汕头市| 平陆县| 禄丰县| 乐都县| 湛江市| 保靖县| 玛多县| 阜南县| 集安市| 肥东县| 甘南县| 卓资县| 东海县| 屯昌县| 平南县| 岳普湖县| 屯门区| 甘肃省| 绥宁县| 柳河县| 河间市| 崇信县| 杭州市| 三江| 湖口县| 孟村| 霍山县| 合阳县| 姜堰市| 揭西县| 平利县| 屏东县| 海安县| 寿宁县|