python Data type conversation

>>> repr(111.5)
'111.5'
>>> repr(10)
''
>>> int("")
11
>>> long("")
22L
>>> float("1.22")
1.22
>>> hex(19)
'0x13'
>>> oct(20)
''
>>> tuple("1,2,3,4,5")
('', ',', '', ',', '', ',', '', ',', '')
>>> tuple("")
('', '', '', '', '')
>>> tuple([1,2,3,4,5])
(1, 2, 3, 4, 5)
>>> tuple({1:2,3:4})
(1, 3)
>>> list((1,2,3,4,5))
[1, 2, 3, 4, 5]
>>> list("")
['', '', '', '', '']
>>> list({1:2,3:4})
[1, 3]
>>>
>>> chr(65)
'A'
>>> ord("A")
65
#list to str
>>> "".join(["a",""])
'a1'
上一篇:KADEMLIA算法学习


下一篇:Hdu1016 Prime Ring Problem(DFS) 2016-05-06 14:27 329人阅读 评论(0) 收藏