python tuple comprehension example
---------------1
>>> dt = (x for x in l1)
>>>
>>> dt
generator object genexpr> at 0x27edaf0>
>>>
>>> dd = tuple(dt)
>>>
>>> dd
('a', 'b', 'c', 'd')
>>>
----------------2
>>> l1 = ['a', 'b', 'c', 'd']
>>>
>>> t = tuple(l1)
>>>
>>> t
('a', 'b', 'c', 'd')
>>>
No comments:
Post a Comment