>>> x = dict(name = "John", age = 36, country = "Norway")
>>> x
{'name': 'John', 'age': 36, 'country': 'Norway'}
>>> complex(10.,20.0)
(10+20j)
>>> int0=12345
>>> str(int0)
'12345'
>>> int0.__str__()
'12345'
>>> float(1234)
1234.0
>>> float('123')
123.0
>>> int('123')
123
>>> int(123.456)
123
>>> eval('10+20-10')
20
>>> tuple('ABC123')
('A', 'B', 'C', '1', '2', '3')
>>> list('ABC123')
['A', 'B', 'C', '1', '2', '3']
>>> set('ABC123')
{'3', '1', '2', 'A', 'C', 'B'}
>>> hex(255)
'0xff'
>>> oct(255)
'0o377'
コメント
コメントを投稿