In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail what are the learning priorities and basic knowledge about Python. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
A brief introduction to the three major characteristics of object-oriented and their respective characteristics
Encapsulation: put the properties and methods inside the class, instantiate the object through the class, access the properties or methods with the object, hide the implementation details of the function, and set the access permission
Benefits: improve code reusability, security, and reduce code redundancy
Inheritance: to achieve code reuse, it can also be understood to establish a parent-child relationship between classes, so that subclasses have the properties and methods of the parent class, and can derive their own unique properties and methods. It should be noted that there is multiple inheritance in python, a feature that other programming languages do not have.
Benefits: reduce code reuse, improve code readability, and standardize programming patterns
Polymorphism: the same method is called by different objects, and the functions are different. Unlike other programming languages, polymorphism in python advocates the "duck type", that is, it does not have to constrain other classes through specific inheritance relationships, as long as these different classes have the same method name and use a unified way to call
Benefits: increase the flexibility of the code and call methods without affecting the internal design of the class
A brief introduction to the difference between interpretive language and compilation
-interpretive type: every time the program is executed, it has to be recompiled, which reduces the execution efficiency, but after providing the corresponding interpreter, it is easier to cross-platform and easy to debug, such as Python,JavaScript, C#
-compiling type: one-time compilation, repeated execution, relatively high execution efficiency, but due to compilation into specific machine code, resulting in poor cross-platform, debugging troubles, such as C _
Summary:
Interpretive language with slow execution speed and low efficiency; good cross-platform performance by relying on interpreter
Compiled language, fast execution speed and high efficiency, poor cross-platform performance depending on compiler
Java language (understanding)
It can be said that it is compiled, and all java code has to be compiled, and there is nothing without compilation.
It can also be said to be interpretive. Java code cannot be run directly after compilation. It can be interpreted and run on jvm.
Because java has different jvm for many different operating systems, java implements a true cross-platform.
List the differences between python2 and python3 that you know
Interpreter default coding
Python2:ASCII
Python3:utf-8
The difference between str (string)
The python2:Unicode type represents the string sequence and the str type represents the byte sequence
The python3:str type represents the string sequence and the byte type represents the byte sequence
Input
Python2:raw_input ('Please enter a user name:')
Python3:input ('Please enter a user name') # is equivalent to raw_input in python2
Input () in ps:python2 must specify a data type, otherwise an exception will be thrown
Output
Python2:
Print ('hello','world') # result: (' hello','world')
Print' Hello'# result: Hello
Python3:
Print ('hello','world') # result: helloworld
Print ('Hello') # result: Hello
The representation of numbers
Python2:64 bit machine, range-2 ^ 63 ~ 2 ^ 63-1; beyond this range, it is automatically converted to long (long integer)
Python3: all integers are int, no long (long integers)
What are the learning priorities and basic knowledge of Python? I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.