mik*_*ike 3 python string syntax
我是Python的新用户,在阅读代码时我不知道某些部分.所以我在这里问.
cmd = u"sudo umount %(mountpoint)s >>%(log)s 2>&1"
Run Code Online (Sandbox Code Playgroud)
我知道那%(word)
是用来代替后来使用的这个词cmd % {'word':'new word'}
,但是我不知道为什么会有一个尾随s
.我不知道字符串开头的'u'意思.
开头u
意味着"Unicode"(即它是一个Unicode字符串).在s
每个格式化后的代码装置来解释的值作为字符串,而不是d
为十进制等
有关所有详细信息,请参阅http://docs.python.org/library/stdtypes.html#string-formatting-operations上的文档.
归档时间: |
|
查看次数: |
1020 次 |
最近记录: |