标签:string类 tps tle NPU span pes oss title href
Python has ways to convert any value to a string: pass it to the repr()
or str()
functions.
这两者都是将值转变为string类型,但是有区别:
str()得到的string类型变量会执行转义等命令,而repr()则直接照搬。
hello = ‘hello, world\n‘ hellos = repr(hello) helloss = str(hello) print(hellos) print(helloss) print(hellos) ‘hello, world\n‘ hello, world ‘hello, world\n‘
标签:string类 tps tle NPU span pes oss title href
原文地址:https://www.cnblogs.com/xuhaojun/p/9195086.html