Old boy Learning Python 5 built-in functions and file operations

Source: Internet
Author: User
Tags pow

Lambda expression:

Built-in functions:

ABS: Absolute Value:

All: The loop parameter, if each element is true, then the return value of all is true

Any only one true, then true

ASCII, using _repr_ in the object, gets the return value:

INT: Converts the other binary data into decimal data:

Bin: Converting a string to bytes

BOOL is judged to be true or FALSE, converting an object to a Boolean value

CHR: Converts 10-binary data to letters in ASCII

Ord: Converting characters in ASCII to decimal characters

Radmon Module

Random.randrange (1.8) generates random numbers from 1 to 8:
Random Verification Code:

Callable: What objects can be executed

Compile: Compiling

Complex Negative

Delattr: Reflection

Divmod (the quotient and remainder form an element)

Eval: Converting a string into an expression

EXEC has no return value to handle the syntax of complex py

EXEC (' For I in range (1,100,2):p rint (i) ')

1, Cmpile compile code 2, execute code



Filter (function, object that can be iterated)

MAP; A function can iterate over an object and make a collection of the returned results

Isinstance: Determines whether an object is created by a class

Issubclass judgment is not a parent class.

ITER creates an object that can be iterated, often with next value, yield mate, generator

Max, Min take maximum and minimum values

POW: Seeking Index

I=pow (2,10)

Round rounding 2.6 will turn into 3 2.5 is 2

Sum sum

ZIP: Put together two elements in a group

-import (aliases when importing)

T

file operations; open

R, read-only mode (default)

W, write-only mode (not readable if the file does not exist, created)

X, write-only mode (unreadable, file not created, error present, used to create file)

A, append mode (there is no creation, there can be additional content

r+, read and write

w+ Write Read

x+ Write Read

A + write read

As long as the write operation is performed, the pointer will be placed in the last

Old boy Learning Python 5 built-in functions and file operations

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.