Viewing the type of a variable, its memory address, and the size of the bytes it occupies in Python
Viewing the type of a variable
# Utilize the built-in type() function >>> nfc=["Packers","49"] >>> afc=["Ravens","48"] >>> combine=zip(nfc,afc) >>> type(combine) <class 'zip'>
Viewing the memory address of a variable
#Use the built-in function id(), is displayed in decimal >>> id(nfc) 2646554913160 >>> id(afc) 2646554913544
View the size of the bytes occupied by the variable
>>> import sys >>> print((combine)) 64 >>> print((nfc)) 80 >>> print((afc)) 80
PS: A way to view the memory address of a variable in python
This article is an example of how to view the memory address of a variable in python. Shared for your reference. The specific implementation method is as follows:
Here you can use the id
id(object) -> integer Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. (Hint: it's the object's memory address.)
I hope that what I have described in this article will help you in your Python programming.
id(x) gets the memory address of the x variable (in decimal)
summarize
The above is a small introduction to the Python to see the type of variable memory address occupied by the size of the byte, I hope to help you, if you have any questions welcome to leave me a message, I will reply to you in a timely manner!