python中内置类型的扩展方法。
modernp的Python项目详细描述
python中内置类型的扩展方法。
用法
整数
(123)实例(int) (123).to_s()=“123” (123).to_f()==123.0和(123).to_f().instance_of(float)
浮动
(123.45)的实例 (123.45).to_s()=“123.45” (123.45).到i()=123
str
“你好。”(str)的实例 “你好”。长度=5 “123”。到i()=123 “123.45”。到F()=123.45 “您好”。to_s()=“您好”
Unicode编码
u“hello”。的实例(Unicode) u“你好”。长度=5 u“123”。到i()=123 U“123.45”。到F()=123.45 u“你好”。to_s()==u“你好”
列表
[1,2,3,4]. [1,2,3,4]长度=4 [1,2,3,4].sum()==10
元组
(1,2,3,4). (1,2,3,4)长度=4 (1,2,3,4).sum()=10