File opening method of Python file processing (i)

Source: Internet
Author: User

Open a file in Python is opened with the same open function, and returns a file object with the following arguments for the Open function:

Open (name[, mode[buf])

Name: File path

Mode: Open mode

BUF: Buffer size

Open a file according to the name, mode, buf you provide, and return the file object, if only fill name,mode default is read-only mode, buf default is 1, the following is some mode of open:

Cases:

1 Print Type (open (' Blog.txt ')) 2 3 # Print Result: <type ' file ' >

You can see that the open returns a file object that can be used to manipulate the file you have opened. such as reading, writing and other operations.

File opening method of Python file processing (i)

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.