For example, when learning lists, tuple, dict, str, OS, SYS, and other modules, using Python's own documentation can quickly and comprehensively learn the functions that are processed. So this self-contained document function can give a lot of
Use the Win32com module to develop an example of window ActiveX: (If you have not installed the Win32com module, please go to http://python.net/crew/skippy/win32/Downloads.html to download).
Copy Code code as follows:
#
Open (Filename,mode,buffer)
The first parameter is the file name of the file you want to open, the second is open, optional, and the third is a buffer, optional. By default, the file is opened in read mode. The function returns the stream type
These files were previously extracted using a colleague's batch file; Not quite handy, just recently learning some python, all on their own to write a Python extract files applet;
1. Principle
The principle of extracting files is very simple, that
First on the script, and so down to tell the knowledge point:
Copy Code code as follows:
#!/usr/bin/env python
#encoding =utf-8
Import Sys
Import re
Import Urllib2
Import Urllib
Import Cookielib
Class Renren (object):
def
In this chapter, the concept of data structure is introduced. Data structures are collections of elements that are organized together in some way. In Python, the most basic data structure is the sequence. Each element in the sequence is assigned an
This is the problem that comes to mind when you review lambda expressions today, and it is well known that the ternary operator (?:) in the C-series language is a very useful statement,
About ternary operators in C
Expression of 1? Expression 2:
This example describes how Python reads all directories and files in a directory. Share to everyone for your reference, specific as follows:
Here is a reading of the directory when just learning Python, to share the following:
Lock
Python's built-in data structures such as lists and dictionaries are thread-safe, but simple data types such as integers and floating-point numbers are not thread-safe, and for those simple data types to operate, locks are required.
Example of a file operation
Copy Code code as follows:
#输入文件
f = open (R ' D:\Python27\pro\123.bak ')
#输出文件
FW = open (R ' D:\Python27\pro\123e.bak ', ' W ')
#按行读出所有文本
lines = F.readlines ()
num =-1
For line in lines:
First, the most basic application
Import urllib2
url = R ' http://www.baidu.com '
html = urllib2.urlopen (URL). Read ()
print HTML
Client and server side through request and response to communicate, the client first sends request to
I. Ipython INTRODUCTION
IPython is an interactive shell that works better than the default terminal, supports automatic indentation, and has built-in many useful functions and functions. Can be used on any operating system.
Two. Installation
Copy Code code as follows:
#-*-Coding:utf-8-*-
def insertion_sort (A):"", "" "" "" "" "" "" "" "" "" ""n = Len (A)If n Return AB = [] # results listFor a in a:i = Len (B)While I > 0 and B[i-1] > A:i = I-1B.insert (i, a);Return B
Def
A simple encapsulation of the Python Web request module URLLIB2.
Example:
Copy Code code as follows:
#!/usr/bin/python
#coding: Utf-8
Import Base64
Import Urllib
Import Urllib2
Import time
Class SendRequest:'''This class with
Python's most recent work is the component compatibility test, the original framework has a lot of features are not perfect, need to add! For example, you need to write the results of the AutoIt script to Excel, and the final solution is to use the
In Python, if the function body is a separate return expression statement, the developer can choose to replace the function with a special lambda expression form:
Copy Code code as follows:
Lambda parameters:expression
A
1. Get file Hide properties via Windows attrib command
Copy Code code as follows:
Syntax
ATTRIB [+ Attribute |-attribute] [pathname] [/S [/d]]
Key+: Turn an attribute on-: Clear an attribute off
Pathname:drive and/or filename e.g.
The Pyquery library is a python implementation of jquery that can be used to parse HTML Web page content using the following methods:
Copy Code code as follows:
From pyquery import Pyquery as PQ
1, can load an HTML string, or
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