If statement:Python uses If-elif-else to describe multiple branching decisions, simplifying nested problems in branching structures. There may be 0 to multiple elif parts, or else is optional. Keyword ELIF is the abbreviation for else if, which can effectively avoid deep indentation. If...elif....elif sequences are used to replace switch or case statements in other languages.
For example:
Print ("Enter an integer of (0-3):")
x = Int (input ())
if x =
Read a lot of Python books, note that I want Python 3, not 2. Very good recommendation, general exemption.
Reply content:Thank you for your invitation.
The basics of Python:
Recommended
Basic Python Tutorials(Turing Programming Series: Basic
(urllib.request.urlopen(‘http://sublime.wbond.net/‘+pf.replace(‘ ‘,‘%20‘)).read())
Restart Sublime Text 3.
If you see the package control item in Perferences->package settings, the installation succeeds.
To install a plugin using the package control method:
Press Ctrl+shift+p to bring up the command panel
Enter install to bring up the Install Package option and enter, then select the plug-in you want to install
1, the Python variable does not need to declare, its assignment operation is both the variable declaration and the definition process;2, each variable in Python must be assigned before use, the variable will be created after the value is assigned;3, the python variable is stored in the memory value, if the variable is
Unicode and then print considering Python's cross-platform operation, it is common to add these two lines at the beginning of the file :# !/usr/bin/env python # -*-coding:utf-8-*-The first line of comments is to tell the Linux/os x system that this is a python executable and the Windows system ignores this comment;The second line of comments is to tell the Python
The code is as follows
Copy Code
"Hello World" 1 Creating hello.py 2 Writing Program: if __name__ = = ' __main__ ':print "Hello World" 3 run Program: Python./hello.py Comments 1 Whether it is a line comment or a paragraph comment, it is annotated with a # plus a space. 2 If you need to use the Chinese annotation in your code, you must precede the Pytho
1. The birth and application of PythonThe founder of Python is Guido van Rossum (Guido van Rossum). 1989 Christmas period, Guido van Rossum (Chinese name: Uncle Turtle) in order to pass time in Amsterdam, determined to develop a new script interpreter, as an inheritance of the ABC language.(Uncle Tortoise: 2005 joined Google to 2012, 2013 joined Dropbox until now, still grasp the core direction of Python de
Section 1 Python also has a good data type: String 2. A String is a String written in ''or" ". 3. Set the brian variable to" Always look on the bright side of life.! "[Python] # Set the variable brian on line 3! Brian = "Always look on the bright side of life! "Section 2 1 Exercise 1 set the variable caesar to Graham 2
XML-RPC realizes simple Peer-to-peer file sharing
First to Baidu Encyclopedia:
The full name of XML-RPC is the remote procedure call that is Procedure called, XML (a subset of the standard Universal Markup Language). It is a set of specifications and a series of implementations that allow programs in different operating systems and environments to implement internet-based process calls. This remote procedure call uses HTTP as the transport protocol, and XML is used as the encoding format for tr
between the start and end quotes is treated as part of a single string, including a hard carriage return and other quote characters. Everything in the Sanchong quotes is the doc string for this function, which is used to illustrate what the function can do. If a doc string exists, it must be the first content to be defined by a function (that is, the first content after the colon).3. Objects of all ThingsIn Pytho
Standard data typesThere are six standard data types in the Python3:
Number (numeric)
String (String)
List (lists)
Tuple (tuple)
Set (SET)
Dictionary (dictionary)
Among the six standard data types of Python3:
Immutable data (3): Number, String (string), tuple (tuple);
variable data (3): List, Dictionary (dictionary), set (collection).
# assigning values to
View Python versionWe can use the following command to view the Python version we use in the command Window (Windows uses WIN+R to bring up the cmd run box):-VThe results of the above command execution are as follows:Python3.3. 2 First python3.x ProgramFor most programming languages, the first starter code is "Hello world! ", the following code is for using Python
Recently, Qian Feng and the good news: Qian Feng Python first class students graduated, only 3 weeks employment rate of up to 100%, the average salary of 13403.2 yuan! So, why are the graduates of the first class of Qian-Feng python so highly paid and employed so efficiently?First, Qian Feng Python is a true full stack
properties to self, because the individual points to the created instance itself.method is the function that binds to the instance, and the normal function is different, the method can directly access the data of the instance;Unlike static languages, Python allows binding on instance variables of any property, such as bart.age .class Student(object): def __init__(self, name, score): self.name = name self.score = score def print_score(self): print(
Woody's Python study Note 3, woodypython
Python Operators
Python logical operators
And Boolean and-if x is false, x and y returns false, otherwise it returns the calculated value of y.
Or Boolean or-if x is true, it returns true; otherwise, it returns the calculated value of y.
Not Boolean no-if x is true, false is
CentOS 7 has a built-in Python version of 2.x, and many programs rely on the 2.x version, which will invalidate some of the Python scripts.For example: Yum, Firewall-cmd, Firewall-config, and so on.If you encounter a similar reference error, this is basically the cause:
[Email protected] bin]# Firewall-configTraceback (most recent):File "/usr/bin/firewall-config", line, in Import GIModulenotfounderror
is called a local variable, and a variable defined at the beginning of the program is called a global variable. The global variable scope is the entire program, and the local variable scope is the subroutine that defines the variable.When a global variable has the same name as a local variable: Local variables work within subroutines that define local variables, and global variables work in other places. anonymous function: A specified function that does not need to be displayed#这段代码def Calc (n
.
Non-digital type
String
List
Meta-group
Dictionary
Tip: In Python 2.x, integers are divided according to the length of the saved values:
Int (integer)
Long (length integer)
You can see the type of a variable using the type function
In [1]: type (name) 4.3.1 calculation between different types of variables1) The number of variables can be calculate
Again the study is a Thu God, the website postedhttp://nbviewer.jupyter.org/github/lijin-THU/notes-python/tree/master/I'm just a little bit familiar with the basics of other programming languages.Chat 4 ListThe addition of the list, which is equivalent to connecting two lists sequentially= [123= [3.2‘hello‘+= [12.0‘hello‘*2# 列表与整数相乘,相当于将列表重复相加We know that a string cannot be modified directly, so what if we want to modify one of those types?It's a lot
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.