We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7302127 commit 757370dCopy full SHA for 757370d
can/message.py
@@ -130,12 +130,11 @@ def __str__(self) -> str:
130
field_strings.append(flag_string)
131
132
field_strings.append(f"DL: {self.dlc:2d}")
133
- data_strings = []
+ data_strings = ""
134
if self.data is not None:
135
- for index in range(0, min(self.dlc, len(self.data))):
136
- data_strings.append(f"{self.data[index]:02x}")
+ data_strings = self.data[: min(self.dlc, len(self.data))].hex(" ")
137
if data_strings: # if not empty
138
- field_strings.append(" ".join(data_strings).ljust(24, " "))
+ field_strings.append(data_strings.ljust(24, " "))
139
else:
140
field_strings.append(" " * 24)
141
0 commit comments