NamedModule_name,Package_name,ClassName,Method_name,Exceptionname,Function_name,Global_var_name,Instance_var_name,Function_parameter_name,Local_var_name.Names that should be avoided
Single-character names, in addition to counters and
#!/usr/bin/python3#The list is mutable and can be modified.Listdemo = [" One"," Both","three"," Four","Five"]Print("type (Listdemo):%r"%type (listdemo))Print("Listdemo =%r"%Listdemo)Print("Listdemo[1]:"+listdemo[1])Print("Insert List")
In a Linux system, messages can be sent with the Mail command, but when sent with an attachment, the attachment is always reported as too large an error. Without knowing how to configure Linux mail, I chose Python for sending messages with
In a Linux system, messages can be sent with the Mail command, but when sent with an attachment, the attachment is always reported as too large an error. Without knowing how to configure Linux mail, I chose Python for sending messages with
Contact Python3 One months, here to share a bit of knowledge, it is also known as warm and new.Before touching python, it was done on the front. Always hope that the contact surface can be a bit deeper. As a result of work needs to learn python,
ImportSelectImportSocketImportSYSImportQueue#Create A TCP/IPServer =Socket.socket (socket.af_inet, socket. SOCK_STREAM) server.setblocking (0)#Bind the socket to the portServer_address = ('localhost', 10000)Print(Sys.stderr,'starting up on%s port%s'%
IF......ELSE Basic structure:
If condition: Do somethingElseDo something
Or
If condition: Do somethingelif condition: Do somethingElseDo something
Python is indented to
The main topic of this lesson
Object-oriented polymorphism
Object-oriented Members
Member modifiers
Special members
Object-oriented other applications
SOURCE extension
Exception handling
Design Patterns and
Module function: In the form of a dictionary, the data exists in the database file.
Use:
>>>Importshelve>>> db = Shelve.open ('a.db')>>> db['a']=[1,2,3,4]>>> db['b']= (1,'a','C')>>> db['C']={'a':'a','b':'b'}>>>db{'a': [1, 2, 3, 4],'C': {'a':'a','
Write a program that calculates September 23, 2016 is the day of the year?defIsleap (year):#year=input ("Please enter Year:") Try: ifYear%4==0 andyear%100!=0:returnTrueelifyear%400==0:returnTrueElse: returnFalseexcept:
#coding: Utf-81. #reverse方法将列表的元素反向存放, changes the original list but does not return a valuex=[5,2,4,3,8]X.reverse () #x [::-1] Do not change list reverse sortPrint X2. #sort方法用于在原位置对列表进行排序x=[5,2,4,3,8]X.sort ()Print
The simplest method under Windows:File---settings--project---Project interpreter----Click the + sign, enter the module name you need to install, click the Install Package buttonInstall under LinuxFirst of all, ensure that the Xshell and the Bantu
# tempconvert.pyval = input ("Please enter a temperature value with a temperature indication symbol (e.g. 32C):") If val[-1] in [' C ', ' C ']: f = 1.8 * Float (val[0:-1]) +32 Print ("Converted temperature:%.2ff"%f)Elif val[-1] in [' F ', '
Python journey 3.1 (list, iteration, function, dic, set, simple application), pythondic
1. List slice.
1. Slice the list.'''Name = ["wangshuai", "wangchuan", "wangjingliang", "wangshuai"]# How do I retrieve the first three elements?# (1) Stupid
Python monitors websites in batches and python monitors websites in batches.
Recently, some new sites have been launched. As the number of sites increases, the management complexity has also increased. As the saying goes: it is difficult to bring
With 5 knowledge points, you can easily get the scope of Python and easily get the scope of python.
1. Block-level scope
Think about the output of running the following program at this time? Will the execution be successful?
# Block-level scope if 1
Python Bubble Sorting example details, python bubble
Three notes for Bubble Sorting:
1. You do not need to cycle all elements in the first loop.
2. Two-layer cyclic variables are associated with the first-layer cyclic variables.
3. The second
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