The collection of Python is not equal to the collection of other languages in a broad sense. Strictly speaking, a list is more like a collection, where set set is an unordered collection of non-repeating elements.* Can be understood as, there is no value only the dictionary of keys. A dictionary of primitive form.1 Creating a CollectionA_set = set () #空集合a_set = {-)To create a collection with list:A_set = Set ([Up, "ABC", 4])2 Modifying a
DataThe data structure is basically---that they can handle the structure of the data or that they are used to store a set of related data.There are three types of built-in data structures in Python----- lists, tuples, and dictionariesListing (list)List is like we want to go to the supermarket to buy things list, the need to buy things listed after the whole structure is the list of data, once created we can arbitrarily add delete modify operations so
Package Control Installation Method1. Open the console by pressing CTRL + ' or View > Show console, then paste the appropriate Python installation code;2.Sublime Text 3 Installation code and enter:Import Urllib.request,os; PF = ' package control.sublime-package '; IPP = Sublime.installed_packages_path (); Urllib.request.install_opener (Urllib.request.build_opener (Urllib.request.ProxyHandler ())); Open (Os.
Python Learning Series (3) (string)
Python Learning Series (1) (basic)
Python Learning Series (II) (basic knowledge)
I haven't updated my blog for a month. I have been a little busy at work recently. I really didn't stick to it. I lost my time and felt necessary to write my blog. It can be seen that my persistence is n
This article is a computer class of high-quality pre-sale recommendation >>>>Python 3 Object-oriented programmingEditorial recommendationsThis book is not an introductory book for Python and is intended for developers who have basic Python experience. If you have experience with other object-oriented languages, you wil
(encode) the encoding format of the program that will be used to change the fileIv. description of Python functions1) Definition of function:def test1 (): Print ("The funtion")def test1 (x): #带参数 "The Funtion" X +=1 return xdef sum (A,b,*args): #*args receives n positional parameters, converts Narimoto group Print (a) Print (b) Print (args)def sun1 (**kwargs): #**kwargs receives n keyword arguments, converts to dictionaries Pr
Two. Install PIP for python3.xIn fact, this is not difficult. Download a package and execute two commands.1. First install the SetuptoolsSmall partners can be downloaded via the Official module library: Https://pypi.python.org/pypiHere I will directly use the wget to the server download version 19.6 (small partners can try the new version of Austria. )wget--no-check-certificate HTTPS://PYPI.PYTHON.ORG/PACKAGES/SOURCE/S/SETUPTOOLS/SETUPTOOLS-19.6.TAR.GZ#MD5 =C607DD118EAE682C44ED146367A17E26TAR-Z
Conditions:
If condition:Statement blockElifStatement blockElseStatement block
Elif represents else if
This is actually legal ... 1
>>> if 1
and represents and
>>> if x > 1 and x
or represents or
>>> x
2
>>> if x = = 2 or x = 3:
print (x)
2
Returns a If B is true, otherwise it returns c A if B else c
>>> ' true ' if 1
While Loop
While condition:
Statement block
Do not need parentheses oh.
>>> x
1.2
>>> while x
Often
Want to output Chinese characters in Python code.But always appears syntaxerror:non-ascii character ' \xe4 ' in the file test.py on line, but no encoding declared.(test.py is my own file, the prompt error appears in line 4th, your file will be prompted accordingly). A simple example of the test.py code is as follows:1 #!/usr/bin/python2 3 print "How are you?"After executing the
Introduction to Python version 3 see the official website of the Liaoche teacher, with a certain guiding learning significance.http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000After installation, open the Python shell directly, first as the program ape favorite Most initial program is the Hello Word program, Python3 in the output
The tutorials on the web are varied and similar. I had some problems with my installation, so I summed up a blog post.Sublime text is a lightweight, cross-platform, textual editor that expands its capabilities through the package.There are a lot of packages that build the Python environment, where I install the Anaconda package.1. Sublime Text Download: HTTP://WWW.SUBLIMETEXT.COM/3Fool-mounted, all the way to the point.1.1 Remove the title bar of the
to install:
Anaconda
Anaconda is currently the best Python auto complement and syntax prompt plugin in Sublime 3, and provides features such as "Jump to Definition", "Find Use", "Show Document", "Auto Rename", and so on.
Djaneiro
Provides support for Django.
Sidebarenhancements
Provides enhanced functionality for the default sidebar. Sublime Sidebar can be ctrl+k ctrl+b (Linux, Win), Cmd+k cmd+b (OS
FigureVoidPrintdict (pyobject * OBJ) Function
Obtain the class type from the dictionaryPydict_getitemstring (pdict,"Second"), Such as functions.
Create a class instancePyinstance_new (pclasssecond, null, null)
Call the instance method pyobject_callmethod (pinstancesecond,"INVOKE","O", Pinstanceperson)
The whole process is like this, not complex, if you want to further study can refer to: http://www.python.org/doc/
Extending and embedding
Python
I. Preparatory work1.python python , and install, configure environment variables (computer-Properties-Advanced system settings-add Python installation path in environment variable-path)2.sublime Text 3 sublimetext3 , and installTwo. Configuring the Python environment for Su
As we all know, ST3 (Sublime Text 3) comes with a build python that can run the. py file directly, but it cannot be used if the input () function is involved.Here are some of my personal things for me to be enough of the configuration, because I am still in the beginning of the Python stage, so the relevant configuration is relatively basic and simple.First step:
Environment: Just re-installed the system for Ubuntu16.04Purpose: Install python3.x, this example installs 3.5.2Steps:1.$ python--versionPython 2.7---> system default installed Version2. Download the corresponding version to https://www.python.org/downloads/3. Install the downloaded version
Tar zxvf python-3.5.2.tgz
CD
Python third-party library OPENPYXL (3)Area MapAn area chart is similar to a line chart, where the area below the drawing line is populated and different variants can be obtained by setting the grouping to "standard", "stacked", or "percentstacked". Standard "is the default.Area Map fromOpenpyxlImportWorkbook fromOpenpyxl.chartImport(AreaChart, Reference, Series,) WB=Workbook () WS=wb.activerows= [ [' Nu
Higher order function: a function that passes a function as a parameter, such asdef Add (x,y,f): return f (x) + f (y)print(Add ( -8,11,abs))Operation Result:19Note:1. Call the Add function to perform ABS (-8) and ABC (11) respectively, and calculate their values separately2, the last to do the operationMap () functionThe map () function is an advanced function built into python that takes a function f and a list and passes the list's elements to t
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.