Exercises:
Define a method Get_num (NUM), the num parameter is a list type, and the element in the list is a numeric type. The other type is an error, and returns an even list: (Note: The elements in the lists are even).def get_num(num):
When we log in to Linux, the input password is not displayed, and in Python it is also possible to do so, which is the Getpass module (not available in pycharm)The Getpass module contains several more useful features:1, GetpassUsage: Getpass.getpass
Implicitly-based class objectEach Python class implicitly inherits an objectFull-Text Code example implementation: enumeration of Poker's suit and card face valueOne, _init () __ Method: Object InitializationDisplay instead of implicit: __init () __
One, character encoding and transcoding1. In Python2 the default encoding is ASCII, python3 default is Utf-82.unicode is divided into utf-32 (4 bytes), utf-16 (accounting for two bytes), Utf-8 (1-4 bytes), so utf-16 is now the most commonly used
Schema.dump and Schema.load
The Schema.dump () method returns an Marshresult object, marshmallow the official API says that the dump and load methods return all Dict objects, but to view the source code, the Marshresult object is a namedtuple.#
One, process and thread Overview:
Process, which is the basic unit of allocating and managing resources during the execution of a program that executes concurrently, each of which has its own address space.
threads, which are part of a
List
Operation
List
Method
Example
Increase
List.append (obj)add element to end
eg.>>> list1=[' hello ', ' world ', ' How ', ' is ', ' you '>>> list1.append ('! ')>>> List1[' Hello ', '
Parisgabrielbasics of getting started with PythonAdd:Mainstream 3 operating large system WINDOWS:WINXP Win7 Win8 Win10unix:solaris (SUN)IOS (Apple Mobile)Mac OSLinux: (Linux-based UNIX-independent system)Android (Android)Ubuntu 16.04 (current
Request Library UrllibUrllib is mainly divided into several partsUrllib.request Sending requestsUrllib.error the exception that occurred during the processing of the requestUrllib.parse Processing URLsUrllib.robotparser parsing Robots.txt------the
Today, my colleague asked me if I have a website to download the novel, I said no ah you want to find which novel (in the Heart a little despise him, thought now what novel in the online not all can find it, self-confident search ability of I
# # Higher Order function-functions that accept functions as arguments are called higher-order functionsdef fn (num): # receives parameters and prints print (num)def# The Accept function is a parameter # ) # Ten -in Python, the
1. Deep copy vs Shallow copyDeep and shallow copies in Python are the same as in Java,
The so-called shallow copy is the copy of the reference.
(The data inside is not copied, and the data is in the same address space as the data in
1 classCompany :2 def __init__(Self, name, staffs=[]):#There is no incoming list when the entity object is instantiated, causing the entity object to share the same default list object3Self.name =name4Self.staffs =Staffs5 6 defAdd (Self,
S is a stringS.isalnum () All characters are numbers or lettersS.isalpha () All characters are lettersS.isdigit () All characters are numbersS.islower () All characters are lowercaseS.isupper () All characters are uppercaseS.istitle () All words are
There are three conditions for running unit tests in an official document1. Create a tests child package for the module and set up the test case2. Set the configuration item test_enable to True, the command line through the--test-enable option3. The
# # Sequential structure-The most basic structure is the execution of a statement in the order from top to bottom.# # Branching structureIf condition:StatementStatement...Elif Condition>:StatementStatement...ElseStatementStatement...-If statement
1, using the module reasonTo save memory2, what is the module
Python code or C language code
Sort by function
3. Module classification
Built-in modules, modules included in the Python interpreter
Expansion module,
Test environment Python3, do not know Python2 can run.The code is as follows:#-*-Coding:utf-8-*-Import Turtle as TT.pensize (4) # Set the size of the brushT.colormode (255) # Set GBK color range to 0-255T.color ((255,155,192), "Pink") # Set brush
69206210
Today took time to learn a bit before the pillow library, previously seen remember this library can be added to the picture text plus numbers, but also to convert the picture into a character painting, but has not been looking to learn
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