爲什麼我得到不同的字符串長度? 嘗試在網上蟒蛇編譯器鍵入此代碼:爲什麼字符串長度不同?
XivelyID=2
XivelyCV=3
PUTjsonBODY='{ "version": "1.0.0", \r\n\
"datastreams" : [ { \r\n\
"id"" : "%s", \r\n\
"current_value"" : "%s" } ]\r\n\
}\r\n'
print PUTjsonBODY %(XivelyID,XivelyCV)
print len(PUTjsonBODY)
print
XivelyID=8
XivelyCV=9
PUTjsonBODY='{ "version": "1.0.0", \r\n\
"datastreams" : [ { \r\n\
"id"" : "%s", \r\n\
"current_value"" : "%s" } ]\r\n\
}\r\n'%(XivelyID,XivelyCV)
print PUTjsonBODY
print len(PUTjsonBODY)
第1次印刷LEN(PUTjsonBODY)爲116
第二打印LEN(PUTjsonBODY)爲114
爲什麼呢?
p.s. 嘗試輸入代碼,並在網上運行:
http://www.compileonline.com/execute_python_online.php
如果上述p.s.2 和底部的文字是完全以準確上述結果是2百達更多的則底部! 爲什麼?