常用鏈接

          統計

          最新評論

          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)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 通山县| 厦门市| 江阴市| 沙雅县| 清苑县| 基隆市| 吴桥县| 连江县| 麻阳| 北安市| 乌兰县| 鞍山市| 和静县| 高州市| 罗山县| 海林市| 池州市| 莒南县| 松滋市| 乐平市| 游戏| 梧州市| 太原市| 公安县| 大关县| 德清县| 临夏县| 永新县| 博客| 漾濞| 满洲里市| 察隅县| 泾川县| 轮台县| 淮安市| 梓潼县| 会宁县| 长兴县| 汾西县| 房产| 巴青县|