the variables of python
来源:互联网 发布:部落冲突黑油钻井数据 编辑:程序博客网 时间:2024/05/16 00:37
This part is easy relatively , if have learned or used javascript ,then you will feel that is very easy . Python's variable is a type of weak type.
Then I will give several examples to explain this question.
no.1:
#don't delimit the type at first
a = 1
a = "abc"
a = 1.88
no.2:
#in one program,the one name can use more than once
var = one
var = "two"
as shown above,in the first one, the "var" is a reference and the "one" is a object,in the second , the "var" became a reference of "\'two\'",and over a perid of time , the first "var" will be deallocated(release).
let's see the simple examples as follows:
>>>a = 1
>>>id(a)
xxxxxx36
>>>a=2
>>>id(2)
xxxxxx12
as shown above, the address is different,so the data is the main and the name is a tag.
>>> a =1
>>>id(a)
XXXXXX50
>>>b=1
>>>id(b)
XXXXXX50
as shown above, the address is equally , then the data have two tags.
I think the two precautions is important ,and if you have others question to add ,I will thanks you very much!
- the variables of python
- JavaScript quirk 6: the scope of variables
- [Python]Functions, Variables, and the Call Stack
- The origin of "Hungarian" notation for naming variables
- VS2010 can not watch the value of local variables
- svn: None of the environment variables SVN_EDITOR...问题解决
- [CF 279D]The Minimum Number of Variables[状压dp]
- cf-279D - The Minimum Number of Variables-数位dp
- the thinker of code complete -- general issues in using variables
- svn: None of the environment variables SVN_EDITOR...问题解决
- python global variables,member variables,instance variables
- Learn Python the Hard Way 6: Ex04 Variables and Names
- The Zen of Python
- The Zen of Python
- The Zen of Python
- The Zen of Python
- The Zen of Python
- The Zen of Python
- HDU 1248 寒冰王座
- 关于形如--error LNK2005: xxx 已经在 msvcrtd.lib ( MSVCR90D.dll ) 中定义--的问题分析解决
- SONY 系列手机 Android 5.1 系统 Root 方法
- js入门(三)——document对象
- maven学习总结(七)——eclipse中使用Maven创建Web项目
- the variables of python
- hadoop2.7.1单机版安装部署
- iOS详解 GCD 串行队列并行队列
- JAVA中如何判断一个输入是数字(小数和整数)还是字符串?
- hdu 5451 Best Solver 快速矩阵乘法 Fibonacci数列的循环节
- 路由器和交换机有什么区别
- linux管道学习 http://blog.csdn.net/qq1355541448/article/details/8460835
- 深度学习Matlab工具箱代码注释——cnnff.m
- Tyvj4071放射性辐射尘题解