📌  相关文章
📜  使用 read() 函数读取整个文本文件 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:13.956000             🧑  作者: Mango

代码示例1
# Program to read the entire file using read() function
file = open("python.txt", "r")
content = file.read()
print(content)
file.close()


# Program to read the entire file (absolute path) using read() function
file = open("C:/Projects/Tryouts/python.txt", "r")
content = file.read()
print(content)
file.close()