python code for debug data lost

This commit is contained in:
YiChin2018
2019-08-06 19:26:30 +08:00
parent 56dafa2198
commit 2b70c8b1d1
3 changed files with 22 additions and 5 deletions
+21 -3
View File
@@ -1,7 +1,25 @@
import re
def main():
file = open('C:/ti/python_test_code/uni/att_notify.psd', 'r')
print(file.read())
file.close()
with open('C:/Users/yichin/Downloads/last-2019-07-18-08-08-57-7.csv', 'r') as f:
readlines = f.readlines()
delimiters = ",", "#", "\n"
for line in readlines:
Types = re.split(', |# |\n', line)
time_index = []
data_index = []
for i in range(len(Types)):
for j in range(len(Types[i])):
if Types[i][j] == "time[ms]":
time_index.append(j)
if Types[i][j] == "voltage[mV]":
data_index.append(j)
index = i
print(Types[index])
print(time_index, data_index)
print(Types[index][time_index[0]])
f.close()
if __name__ == '__main__':
main()
@@ -1,5 +1,4 @@
import unittest
import random
from random import randint
from typing import List, Optional