The original code is as follows:ImportSmtplib fromEmail.mime.textImportMimetext fromEmail.headerImportHeader#the server to sendSmtpServer ='smtp.126.com'#Email user name/password to senduser ='[email protected]'Password='XXX'#sent MailboxSender
ubuntu 16.04本身是自带python的,他本身是自带2.X和3.X,两个版本,默认的是2.X。这里记录一下如果在版本间切换以及如何把python版本切换到3.X下的方法。1. See the version of Python installed in Ubuntu and the Python version currently in useLs/usr/bin/python*python--version2. Set Update-alternatives to toggle
13. Abnormal(1) ErrorSome invalid statements in the program, such as syntax errors, are as follows:1 " AA " 2 syntaxerror:invalid Syntax 3 Print " AA " 4 AA 5(2) Try...except1>>> s = raw_input ("Enter something --")2Enter something--and #这里期望输入, but
For beginners, beginner python, will always encounter such an error, want to understand the meaning of Python errors may not know how to do, here are some of the more common Python error problems, I hope to learn python can help some people.1
Name="My\ tName is {name} and I am {year} old "Print (Name.capitalize ())#首字母大写Print (Name.count ("A"))#总共多少个aPrint (Name.center (40M"-"))#总长度是50, the name string is in the middle of the----Print (Name.encode ())#转换成字符串Print (Name.endswith
List lists belong to mutable list(1) can contain an ordered set of arbitrary objects, "such as any data type, in the same order as we have entered"(2) Access by index in the following table, as shown, can even be accessed with negative numbers-1 is
Many programs have logging requirements, and the log contains information that has normal program access logs, there may be errors, warnings and other information output, Python's logging module provides a standard log interface, you can store
Variable data types: list, Dict, set (modifiable elements)Immutable data types: str, tupleFocus: STR, list, dictList-derived exercises:# Use list derivation: Find all the odd numbers within 100 and multiply all the odd numbers by 3 to write to the
21dayBuilt-in functions:1. ABS () absolute value function2, Dict () Create a dictionary3. Help () Get assistance information4, Min () remove the smallest number from a list5, Max () remove the maximum from a list6, BOOL () Boolean type judgment7,
Recently bored in writing Python crawler, share a crawl to the NBA today Information Python script, may not be written beautiful, have optimized please big God guidance!? /test sudo vim nba.py#!/usr/bin/python#-*- coding:utf-8 -*-class url:
python text string-by- character reversal and word-wise reversal Scene: String-by-character reversal and word-wise reversal first, the string is reversed by character-by-word, python provides a very useful slice, so you just need a sentence to get
Module
Support methods
Description
Json
Dumps/dumpLoads/load
Only basic data types can be processed;For the transmission of data between multiple languages;
Pickle
Dumps/dumpLoads/load
Python Paramiko module use case, pythonparamiko
This article mainly describes the examples used by the Python Paramiko module. The details are as follows.
There are many very good SSH clients in Windows, such as Putty. In the world of python, you
Python: An Example of automatically sending mails to multiple users, sending mails, and adding multiple attachments.
1. Recently, some of the company's data statistics and analysis reports are regularly sent to the mailbox of relevant personnel
Python crawler weather forecast example (getting started with Tom), python Crawler
This article focuses on the Python crawler weather forecast.
This is the site to climb this: http://www.weather.com.cn/forecast/
The requirement is to crawl the
Answer-assisted python code implementation, answer-question python code
The examples in this article share the python code used for answering questions for your reference. The details are as follows:
From screenshot import pull_screenshotimport time,
Example of the mosaic effect in the ps filter implemented by Python, python Filter
This article describes how to implement mosaic in the PS filter using Python. We will share this with you for your reference. The details are as follows:
Here, we use
Talking about before_request and after_request in flask,
This article provides a simple analysis of the usage of before_request and after_request in flask. The examples and descriptions are as follows.
The before_request and after_request methods
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