A data structure: List tuple dict set1. Listlist01 = List () list01 = []A.append (object)A.extend (list)Del A[2]2. TupleContent cannot be changed, length cannot be modified TUPLE01 = (1,2,3,4)3. String4. DictKey must be an object that can be hashed (
1, Python string output there are many kinds. A= ' name:{0},age:{1},sex:{2} '. Format (name,age,sex) FirstName= "Lijiaxiang"Age=12sex= "Male"A= ' Name:{_name},age:{_age},sex:{_sex} '. Format (_name=name,_age=age,_sex=sex) the second typeString also
Used to provide system-level operations:
1234567891011121314151617181920212223242526272829
os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径os.chdir("dirname") 改变当前脚本工作目录;相当于shell下cdos.curdir 返回当前目录: (
Use Python to invoke hbase to install thrift Hbase-thriftThrift service to start HBase: bin/hbase-daemon.sh start Thrift default port is 9090MySQL data synchronization to HBase:1. Put2, IMPORTTSV3. Write the MapReduce job import4, SqoopSimple code:#!
Just look at the example and hit the code. A script that writes a command-line argument called to perform the operation.Reference article link: http://www.jianshu.com/p/a50aead61319#-*-coding:utf-8-*-__author__='Deen'" "Import Argparseparser =
after upgrading the Python version number, perform Yum# yum-y Install OpenSSLThe demo sample is as follows:There was a problem importing one of the Python modulesrequired to run yum. The error leading to this problem was:No module named YumInstall a
After each program has been updated, it will be changed compared to the previous version. These changes will cause the user of the program to be a little trouble!For example, python2.xx and 3.xx changes, enough to make the novice head big!In 3,U '
FunctionDefined1. Basic structureDef func_name ():Func_code2. Three different formsNo parameters: The scenario simply performs some action, such as interacting with the user, printingParameter: It is necessary to perform the corresponding logic,
Python function if you want to call a required definitionIn the definition phase, Python only checks that the function's syntax is not called correctlyThe definition of a function is similar to the definition of a variable, without defining the
namely: S_gbk.decode ("GBK"). Encode ("Utf-8")What the #标明自己 (S_GBK) is encoded (GBK), to decode (decode) or encode (encode)Import SysPrint (Sys.getdefaultencoding ()) #显示 utf-8 file encoded as Utf-8s= "Hello" #但是s是unicode编码#因此s. Decode () is not
Purpose: The system runs Python by default, the system prompts 2.6.6, does not meet the practice environment--cut to 2.7.xSteps1:find command to find all Python-related files#find/name= ' python* '2. Go to the original 2.6.x python path to see which
It's almost one months to learn python, now it's time to fill in the entry standard procedure Hello world! This is probably the entrance ceremony for learning all kinds of computer languages. Python is especially easy to write. As shown below:Print (
Learn C language We all know that variables to be defined before use, but Python does not have to define, can be used directly, this is not the most inverse of the place, the Chinese can be directly taken as the variable name, this is it subversion
A byte of Python in the "Input and Output" section has a small example (io_input.py) dealing with palindrome. The author left a study questions.How to remove punctuation, ignore the case, and then consider whether palindrome?You can learn the RE
Shelve
Shelve is a simple data storage scheme, he has only one function is open (), the function receives a parameter is the file name, and then return a shelf object, you can use him to store things, you can simply think of him as a dictionary,
This article is mainly for you to introduce the centos6.4 under the python3.6.1 installation tutorial, with a certain reference value, interested in small partners can refer to
The example of this article for everyone to share the python3.6.1
This article mainly introduces the Python implementation of the Login interface sample code, small series feel very good, and now share to everyone, but also for everyone to do a reference. Let's take a look at it with a little knitting.
Before
Special data types
>>> List1 = [1, ' Wang ', ' tao ']>>> tuple1 = (2, ' Wang ', ' Tao ', ' Yuan ') #tuple的内容不可更改 >>> dict 1 = { #dict的元素分为 key:value two parts, key cannot repeat ' Wang ': ' Tao ': ' Yuan ': 100}
The use of dict,
The path to Python learning-day 1, the path to python learning dayPython Installation
Go to the official website to download the installation package and select your desired Python version. Python has already entered the 3. x era. It is best to
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