代码示例:(标识:python_file_open_2)
python_file_open_2.py
f = open("demofile.txt", "r")

print(f.read(5))
运行结果: