Skip to content

Commit d4a6da7

Browse files
committed
update timedata example
1 parent fd2dbfa commit d4a6da7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

examples/timedata.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
from wxmplot import PlotApp
44
from datetime import datetime
5-
f = open('time.dat','r')
6-
l = f.readlines()
7-
f.close()
8-
t = []
9-
x = []
10-
for i in l:
5+
6+
with open('time.dat','r') as fh:
7+
lines = fh.readlines()
8+
9+
t, x = [], []
10+
for i in lines:
1111
j = i[:-1].strip().split()
1212
t.append(datetime.fromtimestamp(float(j[0])))
1313
x.append(float(j[1]))

0 commit comments

Comments
 (0)