हिंदी

Write the use and syntax for the following method: read()

Advertisements
Advertisements

प्रश्न

Write the use and syntax for the following method:

read()

टिप्पणी लिखिए
Advertisements

उत्तर

read()method is used to read a specified number of bytes of data from a data file.

The syntax of read() method is file_object.read(n)

The usage of read() methodT

>>> myobject=open(“myfile.txt”,’r’)

>>> myobject.read(10)

‘Hello ever’

>>> myobject.close()

shaalaa.com
Reading from a Text File in Python
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 2: File Handling in Python - Exercise [पृष्ठ ३७]

APPEARS IN

एनसीईआरटी Computer Science [English] Class 12
अध्याय 2 File Handling in Python
Exercise | Q 2. b) | पृष्ठ ३७
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×