Contacted Ruby and found it has a package management tool Rubygem is very useful and has a very complete documentation system Http://rdoc.infoDiscovery Python also has the same tools, including Easy_install and Pip. Just, I did not examine the
Dictionary sort1. Sort by key, forward sort1 Sorted (Dic.items (), key=Lambda d:d[0])2. Sort by value, reverse sortSorted (Dic.items (), key=Lambda d:d[1],reverse=true)3. After sorting the original Dictionay unchanged, if you want to use the
Encountered a Python regular expression, (? u), did not understand what the meaning of the Internet search search, Baidu ranked the first Google ranked the second blog, see the picture inside the explanation, still do not understand, but the search (
http://blog.csdn.net/pipisorry/article/details/45771045Python built-in functionsEnumeration function Enumerate
>>> List (Enumerate (' abc '))
[(0, ' a '), (1, ' B '), (2, ' C ')]
The enumerate function can also receive a second
1.abs () function >>> ABS ( -1) 1>>> abs (1+2J) 2.23606797749979 The ABS function usually returns the absolute value, while the plural uses ABS to return (A+BJ) A and B squared and then take the square root, as shown above 2.pow () and Math.pow ()
1. Code Conversion General hard disk storage is utf-8, read into in-memory Unicode, and how they are convertedA = ' hello ' \xe4\xbd\xa0\xe5\xa5\xbd ' b = u ' Hello ' u ' \u4f60\u597d ' A.decode (' utf-8 ') u ' \u4f60\u597d ' (utf-8 format decoded
1, first to the official website http://pypi.python.org/pypi/setuptools download Setuptools.exe file and install2. It is recommended to add D:\Python27\Scripts to the PATH environment variable after installation, and then use the easy_install pip
1 #-*-coding:utf-8-*-2 #author:pete yim3 #date:13-8-224 #Copyright (c) rcsh Systems Incorporated. All rights reserved.5 ImportWin32print6 ImportWin32ui7 fromPILImportImage, Imagewin8 Import_imaging9 Ten # One #Constants for GetDeviceCaps A # - # - #
You first need to configure the environment variables for Python.Test for a successful configuration, go to the command line, and enter Python.If the configuration is successful.Go to the third-party library's website to download the installation
Learn about list and tuple in Python List Definition The sequence is the most basic data structure in Python. Each element in the sequence is assigned a number-its position, or index, the first index is 0, the second index is 1, and so on.The list
A: IntroductionParamiko is a module written in the Python language that follows the SSH2 protocol and supports the connection of remote servers in a way that is encrypted and authenticated.Two: Installation1.pycrypto InstallationDownload Link: https:
def isphonenumber (text): #固定电话 If len (text)! =: return False # The number of bits is not enough for I in range (0, 4): if n OT Text[i].isdecimal (): return false # area code not if TEXT[4]! = '-':
Small series today to take a look at the basic operation of file files in Python. Now learn to buy first OH:Importing modules: Import OSFirst, we introduce a few common methods:Set Current working directory:Os.chdir ('/tmp ') #设置当前目录为tmp目录To create
Python nesting functionsThe nested function, as the name implies, is the function inside the nested function.
def A(a):
print "I am A"
def B(b):
print "a+b=",a+b
print "I am B"
B(2)
print "Over!
Overview: share a function module that defines an output multi-list element.1. First create a folder for the templateEdit the nester.py file with the following content:def print_lol(the_list): forin the_list: if isinstance(each_item,list):
Python-shared module code
Overview:Share a function module that defines multiple list elements.
1. Create a folder for the Template
Edit the nester. py file with the following content:
def print_lol(the_list): for each_item in the_list: if
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