1. Browser Input URL http://www.python.org/download/https://www.python.org/downloads/release/python-2712/Windows x86-64 MSI InstallerClick on the link to download2. After the download is successful, double-click to open the installation window. The
#!/usr/bin/env python#encoding:utf-8def sum (x,*xarg): print x sum=x print xarg for i in xarg:sum+=i return sum if __name__ = = "__main__": Result=sum (1,2,3,4,6,7) Print result[email protected] ~]# cat Ts.py#!/bin/python #coding: Utf-8def
SYS.ARGV is the command line parameter;Sys.argv[0] Represents the file path of the code itself; Gets the parameters starting from 1.Import SysPrint (Sys.argv[0])count = Int (sys.argv[1])Devicelist = Deviceparser (). Getdevicelist ()If Devicelist is
One, the Python learning moduleToday, learning the contents of the module, the module is to complete a function of a piece of code, can be a combination of several files, a single file can also become a module. Python has a lot of powerful and rich
Python Variable TypeThe value that the variable is stored in memory. This means that there is a space in memory when creating variables.Based on the data type of the variable, the interpreter allocates the specified memory and determines what data
1. Fields:Static fields: Class fields, accessed by classes, have been created when the code is loaded.Normal Fields: Object fields, accessed by objects, are generated when the object is created.2. Method:All methods belong to the classCommon method:
This article mainly introduces: How to use the function in PythonCode:#!/usr/bin/env python#-*-Coding:utf-8-*-# Author by LH#函数里默认形参如果有初始值的话, if the call is not a realistic argument, the default is the initial value in the formal parameter (PS: If
1.__call__Class followed by () represents the object, executes the __init__ method, and () executes the __call__ method after the objectclassFoo:def __init__(self,name): Self.name=namePrint("init func") def __call__(self): print ("callfunc"
Description and application of Python functionfunction definition:A function is a set of statements that implement a particular function. Functions to simplify scripts, functions include built-in functions and custom functionsCustom Function
The knowledge of the list is actually similar to the array in C, which can be inserted and modified. LIST=[A,B,C,D]Tuple tuples, once initialized, cannot be modified. Benefits and absolute safety.Define an empty tuple: t= ()Define a tuple with only
Reference http://www.cnblogs.com/way_testlife/archive/2011/03/29/1999283.html1. Enter data requirementsRaw_input () directly reads the input from the console (any type of input it can receive).Input (), which wants to be able to read a valid Python
This example describes the Python global variable usage. Share to everyone for your reference, as follows:
Global variables do not conform to the spirit of parameter passing, so, usually I seldom use unless I define constants. Today, a colleague
Lock
Python's built-in data structures, such as lists and dictionaries, are thread-safe, but simple types such as integers and floating-point numbers are not thread-safe, and locks are required to operate on these simple data types.
#!/usr/bin/env
One, contains an adorner
#encoding: utf-8########### #含有一个装饰器 ######## #def Outer (func): def inner (*args, **kwargs): #要装饰f1 (), with these two form parameters, You can accept any parameter, no matter F1 defines several parameters print "1"
The common interfaces of the OS module in python and the application of Exception in exceptions, pythonexception
1. OS. path. join (arg1, arg2)
Connect arg1 and arg2 strings and return the connected strings. If arg1 and arg2 are variables, convert
Share the installation of Eclipse plug-in PyDev, eclipsepydev
If you want to learn python during the summer vacation, a good language development environment is the foundation. Because eclipse is installed, you want to install the PyDev plug-in as
Python reads excel files,
I. xlrd description
Xlrd is a module used to read excel documents in python. It must be installed before use.
You can
python setup.py install
.
Method 2,
Install using pip
pip install xlrd
II. Introduction
1. Import
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