python——课堂笔记

24 阅读1分钟
with open("./b.txt",mode="r",encoding="utf-8") as f:
    l = f.tell()
    print(l)
    f.read(2)
    read_location = f.seek(5,1)
    print(read_location)
    la = f.tell()
    print(la)
    # result = f.read()
    # print(result)
    #print("-"*10)
    #print(f.readline())
    print(f.readlines())

#with open("./b.txt",mode="w",encoding="utf-8") as f:
   # string = "Nothing in the world is difficult" \
   #          "for one who sets his mnd to it."
   # size = f.write(string)
   # print(size)


with open("./a.txt",mode="w") as f:
    pass

a = [1,2,3,4,5]
b = [[1],[2]]
c = [[[1],[2]],[[3],[4]]]

csv_file = open('iris.csv')
lines = []
for line in csv_file:
    line = line.replace('\n',"")
    lines.append(line.split(','))
print(lines)
csv_file.close()