1.1 Installing PythonLubuntu-16.04.4-desktop-i386 as the OS for the Python development environment.1.1.1 Installing the Deb PackageUbuntu can use the Apt-get command to manage the pack. Let's start by updating all the packages and installing some of
Program ExercisesProgram: Shopping Cart ProgramDemand:
After you start the program, let the user enter the payroll, and then print the list of items
Allow users to purchase items based on their product number
After the user selects the
Found himself did not really understand the topological sort, and again learned the next
The topology is sorted to meet the following two conditions
Each vertex appears and appears only once.
If A is preceded by B in the sequence,
1 Integer Object PyintobjectAn integer object is a fixed-size Python object that has only one inside ob_ival of the actual integer value saved.typedef struct { pyobject_head long ob_ival;} Pyintobject;2 String Object PystringobjectThe Python
Importurllib.requestImportjsoncontent=input ("Please enter what you need to translate:") URL='Http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule'Data={}data['I']=contentdata[' from']='AUTO'data[' to']='AUTO'data['Smartresult']='Dict'
First Program
Open Pycharm, create a new project, create a new file (suffix. py)
Write the simplest code:print(人生苦短,我用python!)
Execute Python code
Using the Pycharm Run button
Terminal input: Python file name
One: Why use a function?1. Reduce the amount of code2. Maintain consistency3. Easy MaintenanceTwo: definition and use of functionsdef test (parameter): ... function Body ... return valueDefinition of the function:def:
Make a summary of what you have learned before. Before looking at the two-point search method, can only be like rather than understand the approximate. Now with so many days of accumulation of knowledge can be written on their own.And on the basis
Python's reflection mechanism allows us to use strings to dynamically drive different events, such as importing modules, calling functions, etc., involving functions that have hasattr,getattr,setattr,delattr
Hasattr: Checks whether a
There are two main loop statements, one is while and the other is for in range ()To illustrate by case:Write a guess number game, the correct number equals 38. If the number equals 38, the prompt is correct and then ends, and if the number is
Python struct MODULE
Use
Functions in a struct module
formatting strings
Alignment
Format character
Code usage examples
Python reference manual struct module links
Class Member: Field + Method + PropertyFields: Normal (instance objects, saved once per object) + static (global variables, saved only once, all methods shared)Method: Common method (instance method: Self.fun ()) + class method (@classmathod) +
InheritedWhat is inheritanceThe so-called inheritance refers to the same class of objects to provide a common method of processing, subclasses inherit the common things of the parent class. This facilitates the reusability of the code, that is, the
UnitTest a framework for unit testingWhat frame?A collection of a bunch of tools.TestCaseTestSuite test suite, multiple use cases togetherTestloader is used to load testcase into Testsuite.Testrunner is to execute the test case, the result of the
A. Python interpreterCPythonThis interpreter was developed in C language, so called CPython. Running Python at the command line is the start of the CPython interpreter. CPython is the most widely used Python interpreter.IPythonIpython is an
Python crawler-crawls movie information of a website and writes it to the mysql database, pythonmysql
This document writes the crawled movie information to the database for ease of viewing.
First, let's go to the Code:
#-*-Coding: UTF-8-*-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