D08-python Learning file operation

Source: Internet
Author: User

File operations

1, the first knowledge of file operation

2. Read Only (R,RB)

3. Write only (W,WB)

4. Append (A,ab)

5, r+ Read and write

6, w+ write read

7, A + write read (append write read)

8. Other methods of operation

9, file modification and another way to open the file handle

First, the initial knowledge of file operations

Using Python to read and write files is a very simple operation. Commonly used open methods are: R,w,a,r+,w+,a+,rb,wb,ab,r+b,w+b,a+b default is R (read-only mode)

Second, read-only operation (R,RB)

D08-python Learning file operation

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.