I don't understand the result of this code:
aa = 'hello, world'
bb = reversed(aa)
print(bb)
print(list(bb))
print(bb)
dd = list(bb)
print(dd)
print(''.join(dd))
The result:
<reversed object at 0x025C8C90>
['d', 'l', 'r', 'o', 'w', ' ', ',', 'o', 'l', 'l', 'e', 'h']
<reversed object at 0x025C8C90>
[]
Why is dd
[]
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…