- Python Penetration Testing Cookbook
- Rejah Rehim
- 215字
- 2021-07-02 23:08:38
Key differences between Python 2.7 and Python 3
Here are some main differences between Python 2.x and Python 3:
- Print: In Python 2, print is a statement. So, there is no need to wrap the text in parentheses for printing. But in Python 3 print is a function. So, you have to pass the string you need to print to the function in parentheses.
- Integer pision: Python 2 considers numbers without any digits after the decimal point as integers, which may lead to some unexpected results during pision.
- List comprehension loop variables leak: In Python 2, giving the variable that is iterated over in a list comprehension leaks the variable into surrounding scope, this list comprehension loop variable leak bug has been fixed in Python 3.
- Unicode strings: Python 2 requires you to mark the unicode string explicitly with the u prefix. But, Python 3 stores strings as unicode by default.
- Raising exceptions: Python 3 requires different syntax for raising exceptions.
The progression from Python 2.x to Python 3.x is happening slowly, but it is underway. It is good to be mindful that there are material differences between Python 2.x and Python 3 as you may need to deal with code that is written in the version with which you are less familiar.
推薦閱讀
- Metasploit Penetration Testing Cookbook(Second Edition)
- Metasploit Penetration Testing Cookbook(Third Edition)
- 深入淺出隱私計算:技術解析與應用實踐
- Mastering Kali Linux for Advanced Penetration Testing
- 從實踐中學習Kali Linux滲透測試
- 云原生安全與DevOps保障
- 計算機網絡安全基礎(第5版)
- 持續集成:軟件質量改進和風險降低之道
- INSTANT Apple Configurator How-to
- Learning Pentesting for Android Devices
- Hands-On Artificial Intelligence for Cybersecurity
- 信息組織
- Instant OSSEC Host-based Intrusion Detection System
- CTF網絡安全競賽入門教程
- 黑客攻防從入門到精通:絕招版(第2版)