Difference between Python 2 and Python 3
来源:互联网 发布:js settimeout原理 编辑:程序博客网 时间:2024/06/06 00:56
For the beginner of Python, we may feel confused when use python. Because the argument for python 2 cannot use in python 3. This may lead to mistake when we submite out code to codeforces or other site. So, I will list some difference between them:
The first one is input() vs raw_input()
When we get used to
n = int(raw_input())
we may feel unsafe to use the argument like that below:
n = input()
no more raw_input() in python 3.
the second one is range vs xrange
I think xrange is more efficient. Python 3 deprecated xrange.
print n vs print (n)
() is a must in python 3
no more __metaclass__ = type in python 3
more will come! hope to help you geeks!
0 0
- Difference between Python 2 and Python 3
- Difference between __str__ and __repr__ in Python
- Python: difference between urllib and urllib2
- Difference between Range and Xrange in Python
- The difference between Python __init__ and __new__
- Difference between Scopes and Namespaces in python
- difference between Python shallow copy and deep copy
- What's the difference between C++ and Python
- the difference between isinstance and type in python
- The differences between Python 2 and Python 3
- difference between str & list in python
- What is the difference between urllib and urllib2 modules of Python?
- The difference between (()) and ().
- difference between "<" and "<<"
- python中下划线,双下划线,首尾双下划线的区别(Difference between _, __ and __xx__ in Python)
- python中下划线,双下划线,首尾双下划线的区别(Difference between _, __ and __xx__ in Python)
- ExternalInterface , between python and flash
- The difference between read, readline, readlines in Python
- Shape Drawable
- Ironic , Openstack Baremetal Hypervisor
- Java程序员应该知道的10个调试技巧
- 选择排序
- Java网络编程精解之ServerSocket用法详解一
- Difference between Python 2 and Python 3
- android字符串 优化(一)
- Oracle 11g新特性系统分区表
- 『IOS』objective-C: nonatomic retain copy assgin 等属性详解
- iOS 用CornerStone配置SVN,HTTP及svn简单使用说明
- svn异常:subversion.javahl.ClientException
- 第十一周 项目6:(4)输出1000以内的所有回文素数
- 【转】VS2010 设置main函数输入参数
- android的ExpandableListView