I have recently started to learn python. I would like to write this article for my consideration.
1. Basic Knowledge
To learnProgramming Language, Installing its development tools is naturally essential. I have learned Python Based on windowshe
It can be said that modern
Program Languages are more or less affected by the lisp family, and python is no exception. Because I used to know some knowledge about lisp (scheme), I feel that python has learned quite like this.
Filter
After reading the concise Python tutorial for one afternoon, I wrote the n queen'sProgramPlay. The program only uses basic functions. Record it here.
Def
Isok (row, col ):
'''
Is it possible that a queen is put at (row, col )?
'''
For
Python is a very powerful language, which is much more difficult than Ruby. At least I think so. Just as few Chinese documents!
Official Website
Http://www.python.org/
Now an EXE file used in Windows
Tutorial
Http://www.onlamp.org/manual/python_
1. add your own Python module to pythonpath.
If you want the python interpreter to find the module you have compiled, the module must be on pythonpath. Otherwise, the module cannot be found when importing the module, therefore, you must add the
For details about the python urllib module and an example, let's look at an example. This example captures the HTML of the Google homepage and displays it on the console:
Import urllib
Print urllib. urlopen ('HTTP: // www.google.com '). Read ()
Number = 23; # define variablesGuess = 22;If number = guess: # If judgment, note: no lessPrint 'yse'; # note that indentation in python can be used only when it is included.Elif number> guess: # note that it is not else if but ElifPrint 'Big
Isinstance(
Object, classinfo)
Return true ifObject argument is an instance ofClassinfo argument, or of a (direct or indirect) subclass thereof. Also return true ifClassinfo is a type object andObject is an object of that type. IfObject is
Use the PDB module in Python for debugging.
Import PDB
PDB. set_trace ()
You can also use Python-m pdb mysqcript. py.
(PDB) will automatically stop at the first line, waiting for debugging, then you can look at the help
(PDB) h
Describe these key
This section describes the Server framework. The code in the client can reuse its package. py and dispatch. py.
The server is generally running on the console, but most of the clients are with the UI.
Here we will introduce
1. Console
Start main. py
In python, the output tag is similar to the printf () format in C. In python, the % operator is used to format the output string. The common format is
Format mark string % value group to be outputThe "format mark string" on the Left can be exactly
I wrote another webpage data file in Python and downloaded the information on the National Bureau of Statistics website at http://blog.csdn.net/liminlu0314/article/details/7300240.
This is still, but the download is the export Alian Bureau of
1. Connect to the database:
Cx = sqlite3.connect ('database. db'). CX is a database connection object and has the following operations:
Commit () -- transaction commit
Rollback () -- transaction rollback
Close () -- close a database
Almost daily Python write a script for mm-bukepa.org conversion Forum data, need to write some Chinese in the script, found not supported, can only use
Print '/xd7/xAA/xbb/xb3/Xcc/xd0/xf2' to output Chinese characters. It also stops being
Sometimes, you need to package the python program project, that is, to package only the python file compiled after the python file, you need to compile the python file.
There are two compilation methods:
1. Write a python simplified version to
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