This tutorial is a Chinese translation of "A byte of Python" based on python3.0. python3.0 has greatly improved the previous version, for translation, refer to the popular simple Python tutorial on the Internet. Hope it will be helpful for beginners
1. Copy. Copy: only the parent object is copied, and the internal sub-objects of the object are not copied.
2. Copy. deepcopy: Deep copy object and its sub-objects
A simple example is as follows:
>>> Import copy>>> A = [1, 2, 3, 4, [
ArticleDirectory
Self = Java's this
Why use python? The development efficiency is high and can be transplanted.
Syntax:
String:
1,Use single quotation marks (') = use double quotation marks (") = Java double quotation marks (
The most convenient reference book for learning python is the official documentation. The Installation File for Windows contains an official CHM-format package file with complete content. If you are a beginner, you can browse tutorial and write it
When the list cannot meet the needs of people to present information, the label cloud display method can well meet the browsing needs of people who pay attention to key points, highlight trends, and display preferences, this article briefly
1. Some built-in functions:
Coerce converts two variables to the same type.
>>> Coerce (1, 2.2)
(1.0, 2.2000000000000002)
Filter, filter (function, list) (2.
Input () enter a number>>> A = input ("Age :")Age: 20>>>20
Open (), open the file,
Recently, a small tool needs to use the python word process. After reading the python API, the subprocess module can be implemented, and it is quite simple.
To implement a simple self-process, you only need
Import sys, OS, subprocess P =
Example 2-18 demonstrates that the traceback module allows you
Program Print abnormal trace return
(Traceback) information, similar to what the interpreter did when no exception was captured. As shown in example 2-18. 2.11.0.1. Example
2-18. Use
Summary: several methods for downloading Python web pages
1
FD=Urllib2.Urlopen(Url_link)
Data=FD.Read()
This is the most concise method, and of course the get method.
2
Get Method
Def gethtmlsource (URL ):
try: htmsource =
The assert statement is also available in C or C ++. Short assertions. The following is a description from Python help document:
Assert statements are a convenient way to insert debugging assertions into a program:
An assert statement is used to
1 Motivation
For the taskBlogging, You can generate HTML file locally, then using metaweblog API to upload them to your blog hosting site. This workflow has following benefits:
There are always ways to generate HTML documents, you can
I read an article two days ago.Article《Automatically change the desktop by writing scripts on your ownI think it should be easier to understand the implementation of Python, so there is the following dynamic-wallpaper.py script.
Complete
PythonThe Data Types of tuples, lists, and dictionaries are very Python (there python isAdjective. These structures are optimized enough, so if they are used well, they will be of great benefit in some areas.
Tuples
In my opinion, just like the
Lambda functions are also calledAnonymous Functions, That is, the function does not have a specific name. Let's take a look at the simplest example:
Def f (x ):Return x ** 2Print F (4)
If Lambda is used in Python, it is written as follows:
G =
[From] nickname: HolbrookHttp://www.cnblogs.com/holbrook/archive/2012/02/25/2368231.html
We have introduced the mutex lock and condition variable to solve the synchronization problem between threads, and used the condition variable synchronization
Python is an interpreted scripting language, similar to Microsoft Visual Basic Scripting Edition (VBScript), microsoftjscript, Perl, or other scripting languages. For Active Server Pages (ASP) and simple Common Gateway Interface (CGI) scripts, IIS
# ! /Usr/bin/ENV Python # Coding = UTF-8 Import OS, shutil, stringDir = ' /Home/TT-Ava/test ' # If it is a Windows system, follow the Windows directory format, such as c: \ Text For I In OS. listdir
Xlrd is used to retrieve records containing a specified string from a column of data in Excel and generate a TXT file named after this string.
Import OS Import Xlrd, sys # Input the Excel file Filename = raw_input ( ' Input the file name &
After learning python and FME Objects for a few days, I found that many Objects in the tutorial are outdated, and the syntax and vb are quite different, but the concept is the same. Below I will write a piece of python code, link the objects learned
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