What is Python Fileno ()? What does Python Fileno () do?

Source: Internet
Author: User
In this article, let's look at the Fileno in Python (), before we go into the article we first need to know what we are going to learn, and we don't know what it is. Because today is about Pythonfileno ()and explaining what Fileno () means to you. These things we can all learn in today's article.

Overview

The Fileno () method returns an integer that is a file descriptor (a descriptor FD integer) that can be used for I/O operations of the underlying operating system

Grammar

The Fileno () method syntax is as follows:

Fileobject.fileno ();

return value

Returns the file descriptor.

Instance

The following example demonstrates the use of the Fileno () method:

#!/usr/bin/python#-*-coding:utf-8-*-# Open File fo = open ("Runoob.txt", "WB") print "file name:", Fo.namefid = Fo.fileno () print " File descriptor: ", fid# close file Fo.close ()

The result of the above example output is:

The file name is:  runoob.txt file Descriptor:  3

In this article, we understand what is Fileno (), do not understand the words in fact, they can try to do, after all, hands-on practice is the best way to verify the learning. Finally, I hope that this article will give you a little help in learning about Python.

For more information, please visit the PHP Chinese Web Python tutorial section.

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.