- 最後登錄
- 2024-4-26
- 在線時間
- 0 小時
- 註冊時間
- 2013-11-9
- 閱讀權限
- 20
- 精華
- 0
- UID
- 13832635
- 帖子
- 342
- 積分
- 343 點
- 潛水值
- 8180 米
| 第一種
f=open('sin.txt','r')#'w'寫入,'a'增加,'r'讀
data=[]
for line in f:
data.append(line)
print data[0]
f.close()
#with open("sin.txt")as f使用with可以不用f.close)記住要關閉才不會造成負擔
第二種方法(推薦的numpy模組)
mport numpy as np
data=np.loadtxt("sin.txt")#可以把資料存成矩陣 ... |
|