Tidy up the basic concepts and knowledge of Python, mainly using Python3 as the grammar standard.Python IntroductionAn object-oriented interpretive computer design language with rich and powerful libraries.
Python positioning: "Elegant",
1. file operation Process
Open the file, get the file handle and assign a value to a variable
Manipulating a file with a handle
Close File
GrammarOpen (filename, mode)Instance2. File Open mode
R, read-only mode
Preface: Many Python tutorials, the interpretation of Python is not easy to understand, this article records their own understanding and experience, is a preliminary understanding of iterators and generators.Iterators:The essence of an iterator is
Recently, a work environment to do research, of course, the new company new style, need to study Python parallel distributed framework: celery, needless to say, dry Bai.Then took the time to look, sure enough interface simple, easy to develop, 5
Python Base Week jobs1. Two ways to execute a python script脚本前面直接指定解释器在脚本开始前声明解释器2. Briefly describe the relationship between bits and bytes每一个字节占用八个比特位3, briefly describe the relationship between ASCII, Unicode, utf-‐8, GBKutf--‐8 4., please
Get Current working directory# to get the current working directoryChange the current working directory# used to change the current working directory to the specified pathParameters:
Path-the route to switch to.
Return value: Returns
In Python, it is easy to run other scripts or programs using the OS module, so that you can use other scripts directly in the script, or the functionality provided by the program, without having to write code that implements the functionality again.
First, List parsingList parsing comes from a functional programming language (Haskell) with the following syntax:Inif cond_expr]The first syntax: Iterate all the contents of iterable, each iteration, put the corresponding content in the iterable
List&dict&stringThese three types are the most commonly used data types in Python. They're all a kind of sequence.Sequence common operations1. shardingS[A:B] Returns the fragment from S[a] to s[b-1] in the sequence s. Note s[0:0] is an empty set and
First, built-in functionsFunctions that can be used directly without importing the moduleABS () the absolute value; the all () parameter is a sequence, for example: tuples, lists, dictionaries, judging all the values in the sequence are true, then
Two modules for serialization in Python
JSON is used to convert between "string" and "Python Basic data Types"
Pickle for "Python-specific type" and "Python basic data type" to convert between
The JSON module provides four
# Use *args and Kwargs in function definitions to pass variable-length parameters. *args is used as a variable-length parameter list for passing non-named key values (positional parameters); Kwargs as a variable-length parameter list for passing key
Python implements a simple guess number game, as follows:
Randomly generate a number between 1-10, let the user to guess, when guessed wrong, will be prompted to guess the number is big or small, until the user guessed right.
Import Randomsecret =
According to the Python official online plan, the official version of Python3.6 is expected to be released in 2016-12-16, the Friday. Since last May, the Python3.6 version has been developed, with 4 alpha, 4 beta, and one candidate released
Recently began to study Python's parallel development techniques, including multi-threading, multi-process, and so on. Gradually collated some of the information on the Internet, today collated a bit of greenlet related information.
Technical
Python built-in function open () for opening files and creating file objects
Grammar
Open (Name[,mode[,bufsize]])
Name: File name
Mode: Specifies the open mode of the file
R: Read-only
W: Write
A: Additional
R+,w+,a+ supports both input and output
/etc/profile/etc/bashrc, variables are added to the shell environment and are permanently active./root/.bashrc/root/.bash_profileRegular expressionsDefinition: a regular is a way to describe a character or string by combining symbols with special
Upgrade python2.7.X to Python3.6.X, and upgrade macpython2.7 to 3.6.
Upgrade python2.7.X to Python36.X
Install Python3
The project is encoded in the py3 environment, and the default Centos py version is 2. We also need to install py3 to run the
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service