1. Use a dictionary and list nesting structure to represent multiple records2. When adding information, enter a word directly, parse and disassemble, and record time and event3. Different color output with different information#!/user/bin/env Python#
Citation:http://www.cnblogs.com/haiyan123/p/7298967.htmlUnderstanding ModulesCommon Module CategoriesRegular expressionsRe moduleThe relationship between the RE module and the regular expressionCollections Modulefirst, the understanding moduleWhat
#turn datetime into a stringdefdatetime_tostring (DT):returnDt.strftime ("%y-%m-%d-%h")#turn a string into a datetimedefstring_todatetime (String):returnDatetime.strptime (String,"%y-%m-%d-%h")#turn the string into a timestamp
File operations1, the first knowledge of file operation2. Read Only (R,RB)3. Write only (W,WB)4. Append (A,ab)5, r+ Read and write6, w+ write read7, A + write read (append write read)8. Other methods of operation9, file modification and another way
Whole code:Save the following code as a py file fromPILImportImageImportArgparse#command Line input parameter handlingParser =Argparse. Argumentparser () parser.add_argument ('file')#input FileParser.add_argument ('- o','--output')#Output FileParser.
The function of the module is to use the module RawConfigParser() , ConfigParser() and SafeConfigParser() these three methods (three to choose one), create an object to use the method of the object to the specified configuration file to do additions
Python BasicsPython code changes to bytecode to machine code last executionThe ' file name. PYc ' file that appears when the ' file name. py ' file is executed as a byte-code caching mechanismWhen using Pycharm, add the following two lines of code
Remember that the number of elements in the data structure is nListing (list)The list is implemented by the array, and the allocated memory is a contiguous space. Adjust and modify the list elements to return the length of the list, the time
Modifier between% and the conversion character
-, left alignment flag, default to right alignment
+, display numeric symbol
0, 0 padding
A number that specifies the minimum width
. A decimal point, followed by the number of
IdentifierA python identifier is a user-defined name that represents a variable, function, class, module, or any other object. If you specify a name for a programmable entity in Python, it is technically an identifier. The Python language sets a set
Homework Today: First, realize the user registration function Ideas: User input user name, password Store user input in a fixed format, such as: egon:123, depositing files A new user name and password can be
Automatic e-mail notification to administrators when users log in to Linux via Python scriptsSystem Environment CentOS 7#!/usr/bin/env python#coding: Utf-8#导入需要的库, if you do not install it yourselfImport OSImport SmtplibFrom Email.mime.text import
The path of Python day.1The first stage probably learned the basis of Python, grammar has while,if,for and so on, comprehensive knowledge, I combined with the program to write the following, this is a guessing game, need to register and then guess
Although Python is an interpreted language, it has been an object-oriented language since its inception, and it is an object for Python. Because of this, it is easy to create a class and object in Python, but if you are accustomed to writing a
about properties and methods in class classesdef __init__ (self, variable): A method that is automatically called when the class is defined as an objectdef __call__ (self, variable): This is to call the method of the class directly when the function
1. Module callImport Module from Import xx from Import xx as rename from Import *2. Import the module you madeFirst of all, the module can only be used in the current path of the program can be imported, a directory and then import their own
Python beginner, for the guide package tangled a lot of time, summed up sharing, continuous progress ~Two ways to guide the Python package:1.1 from Package. Module Import method name, directly using method name () when invoked1.2 from package.
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