Dive into Python reading pen (3)

Source: Internet
Author: User
Tags file handling

Chapter 6 Exceptions and file handling:

# Use Try...except to catch exceptions

# Use Try...finally to protect additional resources

# Read files

# Assign multiple values at once in a for loop

# Use OS modules to meet your cross-platform file operations needs

# dynamically instantiate classes of unknown types by taking classes as objects and passing in parameters

Chapter 7 Regular Expressions:

^ Start of matching string

$ matches the end of a string

\b The boundary of a word

\d any number

\d any non-numeric character

X? An optional X-character

x* 0 times or more x characters

x+ 1 times or more x characters

X{N,M} x characters, at least n times, up to M times

(A|b|c) A or B or C

(x) typically represents a memory group (remembered group), using the Re.search function to return the object's groups () function to get its value

Dive into Python reading pen (3)

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.