I'm posting a question because I wonder if I can make a list into a tuple.
l = [4,5,6]
t = (4,5,6)
I want to make a tuple t with a list l, but the source code I wrote does not print a tuple, but it is printed as a generator object.
l = [4,5,6]
t = (i for i in l)
print(t)
Output:
<generator object <genexpr> at 0x10e92dd20>
Use tuple() to convert list
to tuple
, just as you use int(3") to convert str "3" to int3.
l = [[4,5],6]
t = tuple(l)
print(t)
Output: ([4, 5], 6)
561 GDB gets version error when attempting to debug with the Presense SDK (IDE)
561 PHP ssh2_scp_send fails to send files as intended
556 Understanding How to Configure Google API Key
555 Who developed the "avformat-59.dll" that comes with FFmpeg?
555 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.