मराठी

Differentiate between readline() and readlines().

Advertisements
Advertisements

प्रश्न

Differentiate between readline() and readlines().

फरक स्पष्ट करा
Advertisements

उत्तर

readline() command enables you to read per line in a content and readlines() command is used to read all the content present in a file at the same time and gives list of that item. The readline method extracts a single line from a file and returns it as a string. The readlines method returns a list of strings containing the contents of the entire file, with each object representing one line of the file. With read, you can also review the full file into a substring.

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 1. b) | पृष्ठ ३७
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×