Windows environments with both Python3 and Python2 installed, the virtualenv and Virtualenvwrapper-win are installed in whichever versionThis version of the virtual environment can be established by setting the Ptyhon version path with the following
1.Hello world!Print ('Hello world! '2. Simple interactionName=input ( ' Enter name:')print('{} OK '). Format (name))print('{} OK '. Format (name[0]))Print ('{} good '. Format (name[1:]))3. The user enters two numbers, calculates and outputs two
1.input (' Please input your name: ')Please input your Name:yuan' Yuan '>>> Name=input (';'); yuan>>> name= ' Hua '>>> Print (name)Hua2.print (' two number added to%.f '% (float (input (' Enter the first number ') +float (Input (' Enter second
1. Sorting by Numbers>>> sorted ([1,-12,13,-4],key=ABS) [1,-4,-12, 13]2. Sort strings sorted by ASCIIBy default, the string is sorted by the size of ASCII, because, as a ‘Z‘ result, uppercase letters are Z a preceded by lowercase letters.>>> Sorted
Simple input-output interaction.
Answer: input (' Please input your name: ')Please input your Name:yuan' Liu '>>> name=input (': '): Liu>>> name= ' Liu '>>> Print (name)Liu2. The user enters two numbers, calculates and outputs the sum of two
1, according to the parameters passed in, the file is located in the directory, matching the regular expression of the file, the number of days to delete, these can be written in the configuration file del_file.conf.del_file3.py#!/usr/bin/env python#
A data typeNumbers (shaping, long-shaped, floating-point, plural)StringListMeta-groupDictionaryCollectionTwo numbers (Int,float,complex)Role: Age, grade, salary, Social security number, QQ number and other numbers relatedDefined:age=10 #本质age =int (1
Using the requests library to get the agent, using the beautiful library to resolve the Web page filter IP#-*-coding:utf-8-*-Import Requests fromBS4 Import BeautifulSoup fromThreading Import Threadheaders= {'user-agent':'mozilla/5.0 (Windows NT 6.1;
Python startswith () and endswith functions, startswithendswithFunction: startswith ()
Purpose: Determine whether a string starts with a specified character or substring.I. Function DescriptionSyntax: string. startswith (str, beg = 0, end = len
Python development,I. Variables
Variable amount during program execution;
Defining a variable is accompanied by three features: Memory ID, data type, and variable value.
Before running other languages, you must manually release the program's
Python uses opencv to read images,
After the environment is installed, the first Hello word example is started: how to read images and save images
Import cv2 import numpy as np import matplotlib. pyplot as plt # Read image Code img =
Python compares the similarities and differences between the elements of the two arrays.
Use set () to obtain the intersection/Union/difference set of two Arrays:
Print set (). intersection (set (B) # intersection print set (). union (set (B) #
Python advanced _ introduction to object oriented advanced and python advanced
Learned the inheritance, polymorphism, and encapsulation of the three object-oriented features. Today, let's take a look at some advanced object-oriented content,
Comparison between input and raw_input in Python, pythonraw_input
Comparison between input and raw_input in Python
Both input and raw_input can receive input. The differences are as follows:
# Input assume that the user inputs a valid Python
Python basic while loop and if judgment examples, pythonwhile
Wlile Loop
While True indicates that it is always True. No matter what conditions, it will be executed downward. Below is an example of writing.
#! /Usr/bin/env pythonage = 24 # assign a
HTTP library requests developed by Python, pythonrequests
Requests is an HTTP library developed based on Python using The Apache2 Licensed license. It is highly encapsulated based on the Python built-in module, which makes network Requests by
Python advanced features-filter, python-filter
Python built-in function filter is used to filter sequences.
Same as map (): filter () also receives a sequence of functions.
Different from map (): filter () applies the input function to each
Python learning notes and python learning notes
Variable
Names are separated by commas;
You can modify the name of a constant in uppercase;
# Author:Csicsiprint("hello world!")name = "Csicsi"name2 = nameprint("My name is", name, name2)name =
Python sequence II and Python sequence II
String
All standard sequence operations also apply to strings, but the strings are immutable.
String formatting:
# Example> 'num is: % d' % 18 'num is: 18 '>>> 'str is % s' % 'string' 'str is string # The
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