forked from dabeaz-course/practical-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxscratch.py
More file actions
69 lines (58 loc) · 1.44 KB
/
xscratch.py
File metadata and controls
69 lines (58 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import os
import sys
import csv
#ask for input file path to show
#input file path and
# read text, csv file and output data
#
dpath = os.getcwd()
dpath += r'\work\data'
print(dpath)
# print("enter .txt file name to read and print")
# tfile =input()
# dpath1 = dpath+'\\'+tfile
# print(dpath1)
# with open(dpath1,'r') as f:
# data =f.read()
# print(data)
# playing with class and stuff
class XMesSec:
# def __init__(self) -> None:
# pass
def __init_subclass__(self,z,x,y,d) -> None:
self.z = z
self.x=x
self.y=y
class XMesLog:
def __init__(self,logid,seg, size, msec) -> None:
self.logid =logid
self.seg = seg
self.size = size
self.sections = msec
#reading and storing logs and printing
def ReadMesLogs(mesfile):
print("reading mes file f{mesfile} ---\n")
logs =[]
with open(mesfile, 'r') as f:
header =f.readline()
hdr = header.split()
logname = hdr[0]
seg = hdr[1]
size = hdr[2]
print(header)
sec =[]
for line in f:
xd = line.split()
s1 = XMesSec(xd[0],xd[1],xd[2])
print('\n')
print("--------done---------\n")
print("enter .csv file name to read and print")
tfile =input()
dpath2 = dpath+'\\'+tfile
print(dpath2)
# with open(dpath2,'r') as f:
# lines =csv.reader(f)
# for line in lines:
# print(line)
ReadMesLogs(dpath2)
print("here!!")