Demo entry 6341249

1

   

Submitted by anonymous on Dec 30, 2016 at 09:41
Language: Python. Code size: 341 Bytes.

#载入所需要的包
import matplotlib.pyplot as plt
import numpy as np
#读取数据
f=open('/Users/yanshi/作业/python_homework/Data.txt','r')
data=[]
data_x=[]
data_y=[]
for line in f.readlines():
    try:
        data.append(float(line.strip()))
    except:
        continue
f.close()
data_x=data[:158]
data_y=data[158:]
plt.plot(data_x,data_y)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).