files, folders in Python (file manipulation function) operation requires an OS module and a shutil module. Get the current working directory, that is, the directory path of the current Python script work: OS.GETCWD ()Returns all files and directory
Now I know there are two ways to do this:1 class inheritance Dict classes definedFor exampleClass A (dict): PassA = A ()a[' name '] = 122 Adding a custom class__setitem__ () __getitem__ () methodClass A:def __init__ (self, cfg={}):self.cfg = cfgdef _
File operationsOpen File: 文件句柄 =open(‘文件路径‘, ‘模式‘)Mode of open FileW #以写的方式打开 (unreadable, does not exist then created, exists delete content) a #以追加的模式打开 (readable, nonexistent then created, append content exists) r #以只读模式打开 "+"
A list of Python:Actually the so-called list I personally feel the same as the array in the shell (just a personal opinion oh), the list is actually a combination of elements:
Format:
Name = [A,b,c,d]
Subscript:
Each
1. Background notesThe IP address of the virtual machine is obtained from the Nova list of OpenStack, but none of these IPs are sorted and grouped, in order to further enhance readability, to perform a sort operation on the IP address, under the
First of all, for the Base64 Module Learning Reference Others Summary:http://blog.csdn.net/wanghai__/article/details/6898032After that, in the process of simulating login, we need to encrypt the user name and use the base64.encodestring () function1
There are three options for booting from the boot:1, put your Python program into a directory of C, and then put its shortcut to the Windows boot from the folder (folder location in the Start menu)2, Python packaged into EXE, put into the Startup
This one's bull X a little bit.This does not involve IO, if you call gevent such as asynchronous IO or non-blocking IO, there is a large framework.######################################################################Iterative server-webserver3a.py #
1. Exit Python with exit () 2. The statement beginning with # is a comment 3, the PY uses the indentation format Code indentation refers to the hierarchical relationship between each line of code by typing a space or tab in front of each line of
What is Python
The origins of Python
Features of Python
Download python
Install Python
Run Python
Python documentation
Compare Python
Other implementations
1. What is PythonPython is an elegant and robust
Python After the introduction of the need for constant practice to deepen the impression, in order to improve their Python coding ability, specifically to find some Python small examples to practice, this is the original address:
CGI has a 500 error because the HTTP header is notGI communication relies on stdout to communicate with the browser.So simply write inside the py-cgi-index.py:#!/usr/bin/env pythonprint ' Hello World 'It is wrong to write like this.The CGI interface
The initial plan is to use Python as a scripting language, selenium as a web-based test tool, and is currently built on the web side. This section mainly records the process of simply setting up a python+selenium test environment, as follows:Basic
Interview Python I think everyone will be asked a question, what is the difference between a list and a tuple in python?In general, I will answer that the list element is mutable, the tuple element is immutable (as in the book or any other blog), in
1. Throwing Exceptions and custom exceptionsPython uses an Exception object (Exception object) to represent an exception, and an exception is thrown when an error is encountered. If the exception object is not handled or captured, the program
Code example for logging on to Tom via python and pythontom via emailIn many python tutorials, we will talk about examples of logging on to or sending emails. This article also provides an example. Log on to tom's mailbox and send a mail. The Code
Common python string processing and python string processing
S. find (substring, [start [end]) # searches for substrings in the specified range and returns the index value. Otherwise,-1 is returned.
For example
>>> B = 'abc'>>> B. find ('D ')3>>>
Get started with python word and pythonword
1. Install pywin32
Http://sourceforge.net/projects/pywin32
Find the python version suitable for you in files. As of this article, the latest version is the pywin32-219 shortcut path:
Http://sourceforge.
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