"python exercise 027" to sort 10 numbers---------------------------------------------There is nothing to say, use Str.split (") to get the input 10 numbers, and then use the Lst.sort () to complete the sorting. The code is as follows:s = input ('
Why cycle, if you want to print a statement 1000 times, if there is no loop, you have to output the statement 1000 times, and use the loop only two lines of code to do this.All loops are Class C, except for language features.While loop: A while loop
Do you want to copy an object? Because in Python, whether you pass an object as a parameter, as a function return value, it is passed by reference.
For reference passing, let's look at a C + + Exchange two number function:
void swap (int &a, int &b)
Default Scope
A while ago, I learned that Lua was the opposite of Lua's default scope and Python. When LUA defines a variable, the scope of the default variable is global (globally, which is not very accurate, and when LUA executes a statement such
So far, I've been using eclipse for a few years now, and most of the time is spent writing python (installing the Pydev plugin) and C + + (installing the CDT plugin).
I recently heard from a good friend about Pycharm and its new free community
Python dictionary built-in method get application, if we need to get the dictionary value, we have two methods, one is through dict[' key '], and the other is the Dict.get () method.
What we are sharing today is the dictionary's Get () method.
Simple data types and assignments
Variables do not need to be declared
Python variables do not need to be declared, you can enter directly:
>>>a = 10
Then your memory has a variable a, its value is 10, its type is an integer (integer). You don't
To sort the list, Python provides two methods
Method 1: Sort by using the list's built-in function list.sort
List.sort (Func=none, Key=none, Reverse=false)
Python instance:
>>> list = [2,5,8,9,3] >>> list [2,5,8,9,3] >>> list.sort () >>> List [
We are familiar with the basic concepts of objects and classes. We will further expand so that we can actually use objects and classes.
Calling additional information for the class
As mentioned in the previous note, when defining a method, you must
The first thing to note is that this is not a very esoteric socket programming, but it will be analyzed in one of the simplest socket programming chat room under the processing of several special exceptions, the code is as follows:
Service
Learn some basic python things, always want to write a program, but write programs do not use the database, appear too low-end, then the Python link MySQL how to operate it? Here is a detailed introduction to the next
I am using the MySQL database
Mysql-python connection, by default everyone will write
Con=mysqldb.connect (user= ' xxx ', passwd= ' xxx ', host= ' xxx ', port=6600,charset= ' GBK ')
Once "GBK" is specified, the default Mysql-python sets the Use_unicode=true. The result is
When using Smtplib, open the server, preferably using the Quit method to close the connection, not close.
Server.quit () #好 #server.close () #不好
Because quit will not only close the connection, it will also close the session. This session crosses
The Pure Python ODBC Library PYPYODBC 1.0 is released, and the new version is compatible with both python2.x and Python3.3.
PYPYODBC is a Python ODBC library that can be seen as a pure Python implementation of the famous Pyodbc library, and they
Today we'll look at how to use Python to work with Excel files, and working with Excel files is often used in the job, and Python takes this into account, and Python itself has its own CSV module.
1. Read the CSV file in Python:
CSV is a comma
# import Smtplib and mimetextimport smtplibfrom email.mime.text import mimetext # define Hair Send list mailto_list=["root@pythontab.com", "10118157@qq.com"] # Set the server name, user name, password, and message suffix mail_host = "smtp.163.com"
Many times we need to format the data, do you have a headache with data formatting in Python? Pprint will do you a great favor.
The formatting used in the Pprint module can display data in a format that is parsed by the parser and is easy to read.
# try to search for some funny related to coding when you're moving more every day stuffDay 00-pep the Zen of PythonEnter python-m this in the shell to see the Zen of Tim Peters PythonIn addition, you can also get this text by import thisCurious
Python socket programming and Pythonsocket Programming
The first thing to note is that it does not record very profound socket programming, but it will analyze the handling of several special exceptions in the simplest socket programming chat room.
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