1. mkdir (path [, mode])Purpose: create a directory, which can be a relative or absolute path. The default mode of mode is 0777.If the directory has multiple levels, the last level is created. If the parent directory of the last level does not exist,
Reprinted please indicate the source and the author contact: http://blog.csdn.net/mimepp
Contact information: Yu Tao
Keywords: Linux, kernel-Python, Python, kernel, thread, safety
Here we will record the crash situation when runtime-python
The Python Regular Expression module is re.
Common steps to use a regular expression:
1. First Use Re. Compile to compile a regexobject to indicate a Regexp2. Use the match and search methods of pattern to obtain the matchobject.3. Use matchobject
ArticleDirectory
Module
Package
Module
A. py file is a python module. Package
Put a bunch of related Python modules in a directory, and add a _ init _. py file to form a pythonPackages. Python packages can be nested. After nesting,
Unicode strings have been introduced since Python 1.6.
Add U or u before the string definition to indicate that the string is a unicode string. If you use type () for testing, you will find that its type is not STR, but a new type of Unicode.
Python version 2.7 required, which was not found in the Registry
Create a file register. py with the following content. then execute the script.
Import sys from _ winreg import * # tweak as necessaryversion = sys. version [: 3] installpath =
Python list, dictionary can be written to file or read from file.
About list: 1) write the file self. existedblog. write ("your item data" + "\ n") 2) read self. existedblog = open ("existedblog", "R + ")
Self. existedblog. Seek (0)
Exchange variable
x =6y =5 x, y =y, x print x>>> 5print y>>> 6
If statement in line
print "Hello" if True else "World">>> Hello
Connection
The last method below seems cool when binding two different types of objects.
fc =["Packers","49ers"]afc
If multiple threads modify a data together, unexpected results may occur. To ensure data correctness, multiple threads must be synchronized.
1. Simple thread synchronization.
The lock and rlock of the thread object can be used for simple thread
In the programming process, you can learn more about the language and some skills, so that you can become a good programmer.
For Python programmers, pay attention to these things mentioned in this article.You can also take a look at Zen of Python
Time and date formatting symbols in Python:% Y two-digit year (00-99)% Y indicates the four-digit year (000-9999)% M month (01-12)One day in % d month (0-31)% H hour in 24-hour format (0-23)% I 12-hour (01-12)% M minutes (00 = 59)% S seconds (00-59)
The following lists someOSModule.OS. SEP can replaceOperating SystemA specific path delimiter.OSThe. Name string indicates the platform you are using. For example, for Windows, it is 'nt ', and for Linux/Unix users, it is 'posix '.OSThe. getcwd ()
Loop Structure:
for x in : else: while : else:
Function:
def ():
The function has no return value type. Return can return any type. The function name is just a variable, an object, which assigns a function name
An explanatory object-oriented language.
Strong type. Although it is declared for changes, once a variable has a value, it also has a type. To assign other values, you must use type conversion.
All objects, classes, functions, and modules are
Document directory
Attrib:
The previous article briefly introduced the basic syntax of Python, mainly from the perspective of C or C ++. This article details the usage of the elementtree library. Elenmenttree is a python library written in C
Address: http://hi.baidu.com/_yuan0518/blog/item/803d8fd24e30fc20970a160c.html
Python-attribute control and Descriptor
1. _ dict _ and _ slots __The dictionary is located at the heart of the class and instance ". The _ dict _ attribute tracks all
Python text: Like other languages, we can pass parameters to your python program in the form of command lines, pyhton can automatically store command line parameters in the ARV variable of the SYS module in the form of a string list. OK. Let's first
The code is very simple, so there is no comment :}
"Uses Windows events and shared memory to implement inter-process communication. "# Readerimport win32event as w32eimport WIN32API as wapiimport mmapfile as mmfhevent = w32e. createevent (none, 0,
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