Match format
Mode
Description
^
Matches the beginning of a string
$
Matches the end of the string.
.
Matches any character, except the newline character, when re. When the
The Python access site can be--urllib modules with standard modules (omitted here), and requests (installation-PIP install requests) modules, requests modules are encapsulated on a urllib basis, More powerful than Urllib module, easy to useImport
How to send an email 1. Open the POP3/SMTP service in the mailbox settings 2, some mailbox with password can not send, must obtain authorization code to be able.Import Smtplib,osFrom email.mime.text import MimetextFrom email.mime.multipart
Reprinted from Http://www.cnblogs.com/dalanjing/p/6978373.html, and made minor changes1. Open cmd installation PyQt5Pip Install Pyqt52,PYQT5 no longer provides tools such as QT Designer, so you need to install Pyqt5-toolsPip Install Pyqt5-tools3.
CSV (comma-separator values) comma-separated value, because it is a plain text file, any editor can be opened. CSV file operation in CSV and pandas two ways
Raw CSV file contentsSupplier name,invoice number,part number,cost,purchase
Just use the while condition to determineServer-side#-*-Coding:utf-8-*-__author__ = "MuT6 sch01ar" Import socketserver = Socket.socket () server.bind ((' 127.0.0.1 ', 8080)) Server.listen () While true: conn,addr = Server.accept () and true:
Time Module
There are many modules in Python that allow us to process time information.
Time Module
datetime Module
Pytz Module
Dateutil Module
Here we highlight the first two types of
Time Module
Python Crawler Basics1. Get Web page textGets the HTML text content of the Web page and returns it from the URLLIB2 package, based on the URL#Coding:utf-8Importrequests, JSON, time, RE, OS, sys, timeImportUrllib2#set to Utf-8 modeReload (SYS)
While loop#!/usr/bin/python#coding: Utf-8I=0Sum=0While iI+=1Sum+=iPrint sum first operation and then sum
>> print "sum is:%d"%aSum is: 100 placeholder,%d= placeholder the next input is the number%
Break interruptedWhile
Base operatorHttp://www.cnblogs.com/alex3714/articles/5465198.htmlIdentity operator: is isn'tMember operator: in No in# #in to determine if an element exists in the queue that exists in the return tureA= "ABC"Print ("B" in a)num + = 1 equals num =
Exception handlingException handling is the work of writing code must be completed, for the operation does not meet the expected, the program will always be abnormal situation, and the exception can be properly handled, is to ensure the stability of
CollectionSet (set) is an element dataset that does not need to be duplicated, the difference between the comparison list is first unnecessary, the index cannot be accessed, and the other feature is that there is no duplicate data.In project
Python's built-in document Test (doctest) module extracts the code directly from the comments and executes the test.Doctest strictly follows the input and output of the Python interactive command line to determine whether the test results are
Usually when we are processing data, some data types are not what we want to do?One, data type conversion: the type to convert (data)
To convert num01 to integers: Int (num01)
To convert num01 to floating point: float (NUM01)
To
Chapter 3 python3, python3
Python includes the following functions:
Serial number
Function
Instance
1
List. append (obj)Add a new object at the end of the list
2
List. count (obj)Count the number of
PyQt5 open file dialog box QFileDialog instance code, pyqt5qfiledialog
This article focuses on the code example of QFileDialog in the PyQt5 open file dialog box, as follows.
Open a single fileQFileDialog.getOpenFileName() Open multiple
Python write log, python log
There are many ways to write logs. I like this method and you can make a reference.
Nothing to say, directly go to the code
Import timedef write_log (value): now_time = time. time () # obtain the current date and time
Python fault tolerance,
# Try: release T: else:
# Why is it fault tolerance? Let's talk about the error first. The error mentioned here is not a bug left in the script because it is so careless or because it cannot be removed. The so-called "let
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