Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How python closes a file

Shulou Source: shulou.com Published: 2022-05-31 11:13:36 10月05日 Update

Today, I would like to share with you the relevant knowledge points about how python closes a file. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

The details are as follows:

Close () syntax

File.close () # file refers to a file object

Examples of use:

#! / usr/bin/python

#-*-coding: UTF-8-*-

# www.xieniao.com

# Open the file

Fo = open ("yisu.txt", "wb")

The print "file name is:", fo.name

# close the file

Fo.close ()

These are all the contents of the article "how to close a File by python". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Documents knowledge articles content different very big most objects that is more knowledge points examples industry grammar information information channels logic facets channels Tiandu Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi vpn Huawei Shulou Tech Info Redmi