DrSchool Learn coding, fast.
EN AR BN CS DE EL Search

File Read — Example 126

Quick explanation + ready code for: File Read.

Python File Read Back to examples
Back to language
Syntax: File Read in Python. ID: #126

Code

with open("README.md","r",encoding="utf-8") as f:
  print(f.read(120))

Notes

You can copy this snippet and adapt it. For advanced, add real-world inputs, edge cases, and tests.