Python Basic Syntax-dictionaryA dictionary is the only type of mapping in Python that stores data in the form of key-value pairs (key-value). Python computes the hash function of key and determines the storage address of value based on the computed
Requirements:Catch the weather from the weather website, check whether it rains on the day 6 o'clock every day. If it rains, email alerts with umbrellas.Code:[[Email protected] ~]# cat weather.py#!/usr/bin/python# -*- coding: utf-8
1. View the current Python versionPython-vPython 2.6.62. Download Python-2.7.12wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz3. Unzip and change the working directoryTar zxvf python-2.7.12.tgzCD Python-2.7.124.
Next, I'll write an example that reinforces the understanding of regular expressions. Or back to the home page we downloaded, in practice, we do not need the entire content of the page, so we have to improve the program, the information on the page
The main function of NumPy is to perform matrix operationsTo import a package first when you use itImport NumPy as NPNp.version.version to view version information# Building a one-dimensional arrayN1=np.array ([one-off]) notice the parentheses
Foreplay: The data series in Python is divided into variable (mutable) and immutable (immutable) twoImmutable: string, int, float, tupleFeature: The same object occupies only one memory address, regardless of how many variables refer to it, such as
Tag: Jump out of loop--line test str use file textRead and write filesExample 1, write:A= ""I Love PythonBecause Python is fun "#定义一段文本F=open (' Test.txt ', ' W ') #用open方法打开名为text的txt的文本文件, followed by a comma with ' W ' written meaningF.write (a) #
Python has a lot of editors, you can use CMD to learn, but today I still talk about editing python with sublime.Because Python is an explanatory language, we want the input to be output. Such as:How to get such an editing environment? Let's take a
List
API
function
equivalent Operation
List.append (x)
Add an element to the end
A[len (a):] = [x]
List.extend (L)
Add a list of elements to another list
A[len (a):] = L
Python learning path (3): python learning pathPython learning path (3)
Python 3.61. Set part
A set is an unordered and non-repeated data set. It is mainly used for deduplication and link testing: intersection, difference set, and Union set.1.1
Python garbage collection mechanism and python garbage collection
There are three main Python garbage collection mechanisms. The first is to use the reference count to track and recycle garbage.For reference problems, we use the mark-clear method.
Basic Python-string, basic python stringString Creation
s = "Hello World"String Common Operations
Join ()Concatenates the elements in the sequence with specified characters to generate a new string.
>>> s = ["1", "2", "3", "4"]>>> ".".join(s)1.2.3.4
Python + Selenium notes (10): Element Wait Mechanism, pythonselenium
(1)Preface
If the target element cannot be found due to sudden resource limitations or network latency, the test report shows that the test fails. In this case, a latency
(Self-developed artificial intelligence) pythony tuples, emerging artificial intelligence pythony
How to Create a tuples:
The tuples are enclosed in parentheses, and the elements in the parentheses are separated by commas.
Different from the list,
Function (1), function (
Define functions:
# Syntax def function name (parameter 1, parameter 2, parameter 3,...): '''comment ''' value returned by return of function body # function name must reflect its meaning
Process: A function with no return
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