Last active
June 4, 2023 05:50
-
-
Save msymt/5ebd6a5d462797d5620c6b862442f596 to your computer and use it in GitHub Desktop.
candumpのdumpファイルからcan idだけuniqueに抽出するpythonスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DUMP_FILE = "CANDUMP.log" | |
can_id_array = [] | |
with open(DUMP_FILE, 'r') as f: | |
while True: | |
data = f.readline() | |
if not data: | |
break | |
sp_pivot = data.find('#') | |
can_id = data[sp_pivot - 3:sp_pivot] | |
# print(can_id) | |
can_id_array.append(can_id) | |
can_id_array_u = set(can_id_array) | |
print(can_id_array_u) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment