How Can i Print The Location address Of a element of list? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

How Can i Print The Location address Of a element of list?

such as Garbage Value u can call... the location address of a elwment

6th Apr 2017, 5:31 AM
Rakib
Rakib - avatar
2 ответов
+ 3
a = [i for i in range(10)] print('a is here:', hex(id(a))) for i in a: print('a item:', i, 'is here:', hex(id(i))) Pls note that the address of the list and its items may have little in common... :)
6th Apr 2017, 6:31 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
Thanks
6th Apr 2017, 6:52 AM
Rakib
Rakib - avatar