मराठी

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×