📅  最后修改于: 2022-03-11 14:45:39.697000             🧑  作者: Mango
# Basic syntax:
with open('your_file', 'r', newline='') as file:
data = file.read().splitlines(keepends=True)
# Where:
# - newline='' causes line endings to be returned to the caller untranslated
# - keepends=True causes newline characters to be retained after splitting
# See additional Python documentation about this here:
https://docs.python.org/release/3.2/library/functions.html#open
https://docs.python.org/3/library/stdtypes.html#str.splitlines