林逸民python檔案file方法methods

f = open("ascii.txt", "r")
#註解開啟open檔案ascii.txt讀取模式r開啟之後要關閉
x = f.read()
f.close()
print("檔案長度", len(x))
print("列印內容",x)
f = open("ascii.txt", "r")
y = f.readlines() #輸出成串列list,長度是列數
print(y)

留言

這個網誌中的熱門文章