Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 59584db

Browse files
ミリ秒を修正
1 parent 47717c1 commit 59584db

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,5 @@ dmypy.json
130130

131131
/.idea
132132
.vscode/settings.json
133+
input
134+
output

txtToCsv.py

100644100755
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Copyright (c) 2021. 楊鵬. All Rights Reserved.
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2023. 楊鵬. All Rights Reserved.
23

34
from datetime import datetime
45
import sys
@@ -97,7 +98,7 @@ def create_data_from_file(file_name, keyword, device_code):
9798
data_json = {'TIME': []}
9899
keys = []
99100
i = 0
100-
index = KEYWORD_LIST.index(keyword);
101+
index = KEYWORD_LIST.index(keyword)
101102

102103
if index == -1:
103104
print('can not found keyword from file name...')
@@ -112,7 +113,7 @@ def create_data_from_file(file_name, keyword, device_code):
112113
if (key == 'ABS_MT_PRESSURE' and row[VALUE_FROM:VALUE_TO] == '00000000') or (
113114
key == 'ABS_MT_TRACKING_ID' and row[VALUE_FROM:VALUE_TO] == 'ffffffff'):
114115
continue
115-
data_json['TIME'].append(str.strip(row[TIMESTAMP_FROM:TIMESTAMP_TO]))
116+
116117
# 生データに項目名及び順番を取得
117118
if not (key in keys):
118119
keys.append(key)
@@ -141,6 +142,7 @@ def create_data_from_file(file_name, keyword, device_code):
141142
i += 1
142143

143144
if i == len(keys) and key == EVENT_STOP_FLAG:
145+
data_json['TIME'].append(str.strip(row[TIMESTAMP_FROM:TIMESTAMP_TO]))
144146
i = 0
145147
if len(keys) == 0:
146148
print('device_code:', device_code, 'is missed...')
@@ -168,7 +170,7 @@ def data_convert(data_json, keys, user_id):
168170
# 行データ
169171
row_data = []
170172
rows = []
171-
max_len = 0;
173+
max_len = 0
172174
for i in range(event_count_all):
173175
event_count_in_row += 1
174176
for col in COLUMNS:

0 commit comments

Comments
 (0)