要点: is 判断是否是同一个对象.是通过id来判断的 == 是通过值来判断的 为了提高内存利用率对一些简单的对象,如一些数值较小的int对象,python采用重用对象内存的方法 例如指向a=2,b=2时,由于2作为简单的int类型且数值小,python不会两次为其分配内存,而是只分配一次,然后将a与b同时指向已分配的对象:>>> a=2>>> b=2>>> a is bTrue>>> a == bTrue 如果赋值的不是
print input urlopen print print在版本2的使用方法是: print 'this is version 2' 也可以是 print('this is version 2') 但到了3,就只能加上括号,像一个函数一样来使用 print: print('this is version 3') 假如你看了基于2的教程,然后又装了python 3,可能就会奇怪为什么完全照着写,结果却不一样. input 而 input 就更绕一点.Python2里面有两个用来从命令行接受输入