To this topic you may have guessed what I will say next, hehe, right, that is to list these two different versions of the But not!
You'll find that Python has two major versions, Python2 and Python3, but Python is different from other languages, backward-compatible, and Python3 is backward-compatible, but most of the components and extensions are based on Python2, Here's a summary of the difference between
Conversion of Python 2.7 to Python 3.X under UbuntuSince Ubuntu itself comes with Python 2.7, and Python 3.X is a lot different from 2.7, there are many inconveniences when using Python
This article compares the execution efficiencies of the Python 2 and Python 3 pairs of collection-list
First I define a for_test function, and then use the Magic function of Ipython to perform the test of execution speed%timeit
%timeit automatically executes the objective function more than once to obtain a more accurate result.
in the process of testing, we
Python function Programming Guide (3): iterator details, python programming guide
3. iterator
3.1. Iterator Overview
An iterator is a way to access elements in a set. The iterator object is accessed from the first element of the set until all elements are accessed.
The iterator cannot be rolled back and can only be ite
Familiar with Python (3) and familiar with python
String is a topic center.
ID of a string
In many cases, we need to perform operations on each character in the string (see the following content for details). To perform operations accurately, we must perform the task of numbering the characters. For example, if there are 50 students in a class and all of these st
Python 3 Study Notes (4) ---- character encoding, functions and parameters, python Study Notes
I. character encoding and Transcoding
1. In python2, the default encoding is ASCII, and in python3, the default encoding is unicode.2. unicode is divided into utf-32 (4 bytes), UTF-16 (2 bytes), UTF-8 (1-4 bytes), so UTF-16 is now the most commonly used unicode version,
defWarpper (*args, * *Kwargs):6Start_time =time.time ()7 func ()8Stop_time =time.time ()9 Print("The func run time is%s"% (stop_time-start_time))Ten returnWarpper One A @timmer - deftest1 (): -Time.sleep (3) the Print("In the test1") - - -Test1 ()5. Knowledge needed to implement adornersRealize the Knowledge reserve of adorners:(1) function is "variable"(2) Higher order functions(3)
Python basic syntax (3): python basic syntax
Define Variables
In Python, it is very easy to define a variable. In Python, the definition does not need to end with a semicolon. For example:
a = 10b = 3print(a*b)
Judgment statement
The if judgment Statement of Pyhon is co
Tip: We must not destroy the environment of the system. Because several key applications depend on the Python 2.7.5(TheCentOS 7 default version). If you replace the system's Python environment, there will be a lot of unpredictable errors and even a system reload.Pre-Installation Preparation
Yum-y Install epel-*Yum Clean AllYum MakecacheYum-y install gcc openssl-devel bzip2-devel expat-devel
Basic Python knowledge (3): Basic python knowledgeI. Functions
Def function name (): Code encapsulated by the function...
Def is short for define
Other Python files can be introduced and called.
DefinitionAnd other code including comments keep two blank lines
PycharmDebuggingHour
NotePress Ctrl + Q to view th
40. Function Description:Document descriptionProcedure is a function with no return valueProcedures also have return values in Python: (Explicit)41. Function Introduction 2To realize the exhausting log functionReference the above time formatReturn is the terminating statement:Put it into a tuple and return it to you.Return the TEST2 function memory address:What's returned:Why do you want to return a value? Because I want the result of the entire execu
default folder"% Len (Filearray))GE = len (filearray)Matrix = [None] * GE# implement read and write data# The following is the reading of all the files into the three-dimensional list cell[][][] (not including the table header)Import xlrdFor IInchRange (GE):fname = Filearray[i]BK = Xlrd.open_workbook (fname) TrySH = bk.sheet_by_name ("Sheet") Except Print"Sheet not found in file%s, read file data failed"% fname)nrows = Sh.nrowsMatrix[i] = [0] * (nrows-1)Ncols = Sh.ncols For MInchRange (Nrows-1)
Import OSDefRemove ():Filearray = []Address_excel=E\\Totally\\Financepdf "F_list = Os.listdir (address_excel) For FileNAMEIn F_list: # Os.path.splitext (): Detach file name and extension if os.path.splitext (FileNAME) [ 1] = = Filearray.append (FileNAME) # above is to read all the Excel tables from the Pythonscripts folder and store all the names in the list Filearray print ( "There are%d documents in the default folder"% Len (filearray)) GE = len (filearray) for I Span style= "COLOR: #c
Assume is s a string of lower case characters.Write A program This prints the longest substring of in s which the letters occur in alphabetical order. For example, if s = ‘azcbobobegghakl‘ , then your program should printLongest substring in alphabetical order Is:begghIn the case of ties, print the first substring. For example, if s = ‘abcbcd‘ , then your program should printLongest substring in alphabetical order IS:ABC# Paste Your code into this boxCount = 1result = S[0]While S:Newcount = 1New
The dummy_thread module is called the _dummy_thread module in Python 3, and the Python 2to3 tool can help you automatically change the name of the module in the old code. However, it is more recommended to use a high-level dummy_threading module than this module. As with the dummy_thread module, the Python
Python interpreter to understand Python code, there are a variety of Python interpreterCPythonThe official version of the Python interpreter, developed in C language, uses the broadestIPythonBased on CPython, increased in interactive modePyPyIncrease execution speed and use JIT techniques to dynamically compile
Visual studio 2015: Build a python development environment, and get started with [3], 2015 python
In the previous blog, I set up a python development environment in Windows. I was a beginner in python. Many school friends mentioned that they wanted to use visual studio 2013/
L If __name__ = = ' __main__ ': # when running as a script n __name__ detection is only ture when the file is running , is false when it isloaded , and is determined when it isrun as a top-level script ture N run: Command line, click the file icon, use IDLE GUI N Each Python module has a built-in __name__ variable that, when it is run as a program and not imported as a library,will be set to the __main__ string by
Start to calm down and learn the basics of Python: the python tutorial
I read some of the previous chapters today. For more information, see:
------------------------------------------- I am a pangpang separator line ------------------------------------------
Important points of attention include:
1) Length of Chinese Characters
According to the test, one Chinese Character occupies three. For details, se
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.