You can use the python package to create a simple web server. In dos, CD to the path to prepare the root directory of the server. Enter the following command:
Python-mWeb Server Module[Port number, 8000 by default]
For example:
Python-M
I have been watching the core programming for a while, but it is still full of fog. Today I occasionally see a buddy's note on cnblogs, which is a good summary. It is a good summary for those who have read the textbook.
Python Study Notes (1):
The custom class is as follows:
Import Math Class Circle: # Construct a circle object Def _ Init __ (Self, radius = 1 ): Self. Radius = Radius Def Getperimeter (Self ): Return 2 * Self. radius * Math. Pi Def Getarea (Self ):
1. Python File Processing
Today, we found that when processing files on Mac OS X, three modes are 'R', 'w' ('R + ', 'W +'), and 'A '.
The 'A' mode must be used for append on Mac. It seems that 'W + 'can be used in the past.
F. Close () serves
In these two languages, the returned values of expression A and B are not true or false, but non-true values of expression a/B, it indicates that A or B returns the true one for a/B.
Therefore, to simulate the ternary operator C in C/C ++? A: B. It
When there is no ide at hand and you are worried about Python debugging, you can refer to this article. (PDB command debugging)Reference: http://docs.python.org/library/pdb.htmlAnd (PDB) Help
First you choose to run the pyPython-m pdb myscript. py
Requirements:You want to copy an object, because in Python, whether you pass an object as a parameter or as a function return value, it is passed by reference.Discussion:The copy module in the Standard Library provides two methods for copying. One
Recently, we need to export the site address of the Google search results. Then, the regular expression in python is used to extract the search results.
This involves several issues to be solved:
1. Obtain the search result text
To get more
Http://blog.csdn.net/winterttr/article/details/2590741
Author: winterttr (reprinted, please note)
I think this title may be a problem for beginners. Especially those who are familiar with C/C ++ like me, just entering the python Hall
. The method of
Some friends asked me to help with a log monitoring script some time ago. The requirements are as follows:
1. Windows Environment
2. Sound is triggered when the keyword of the log is matched. The matching keyword is different and the playing
#! /Usr/bin/ENV Python # encoding: utf8import OS, sys # global definition # base = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F] Base = [STR (x) for X in range (10)] + [CHR (X) for X in range (ord ('A'), ord ('A') + 6)] def bin2dec (str_num ):
File Operations and input/output in Python
We can useraw_inputAndprintStatement to complete these functions. For the output, you can also use a varietystr(String) class. For example, you can userjustTo obtain a string that is right-aligned by a
Exceptions in Python
An exception occurs when some exceptions occur in your program.
I. Handling exceptions
We can usetry..exceptStatement to handle exceptions. We place the common statements in the try-block and the error handling statement in
Today, when I was hanging out on csdn, I suddenly saw an article about Python. I had the idea of reading this language, so I wrote these notes.
Python can be.
Type python at the shell prompt of the command line to start the interpreter. Enterprint
1 callable built-in functions determine whether a name is a callable Function
>>> import math>>> x = 1>>> y = math.sqrt>>> callable(x)False>>> callable(y)True
2 record function (document string)
>>> def square(x): 'calculates the square of number
1. Python program structures.
(1) programs are composed of modules.(2) modules contain statements.(3) statements contain expressions.(4) expressions create and process objects.
2. Python built-in types:
, List refers to the collection without
Functions in Python (1)
Friends who have been familiar with C language must be very familiar with the word function. No matter which programming language, functions (of course, in some languages called methods, the meaning is the same) all play a
The old WebService calling methods described in dive into Python need the following packages: pyxml, fpconst, soappy
Basically, the above packages will not be maintained in or later, and most of them will not support python2.5 or later versions.
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