用readlines()方法读取文件内容,当设置不同的hint参数时,比如hint=1,23...为什么结果都是只取第一行的内容啊?
代码如下:
# read.py f = open('test.txt','r') # s1 = f.read(3) # s2 = f.readline(1) s3 = f.readlines(5) # print(s1) # print(s2) print(s3)
代码如下:
# read.py f = open('test.txt','r') # s1 = f.read(3) # s2 = f.readline(1) s3 = f.readlines(5) # print(s1) # print(s2) print(s3)
2021-05-07
举报