We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7350552 commit 7a1d502Copy full SHA for 7a1d502
1 file changed
python-join-strings/format_event_log.py
@@ -2,20 +2,20 @@
2
3
4
def load_log_file(file_path):
5
- with open(file_path, mode="r", encoding="utf-8") as event_log_file:
6
- return json.load(event_log_file)
+ with open(file_path, mode="r", encoding="utf-8") as file:
+ return json.load(file)
7
8
9
def format_event_log(event_log):
10
lines = []
11
for timestamp, events in event_log.items():
12
- # Convert the events list to a string separated by commas.
+ # Convert the events list to a string separated by commas
13
event_list_str = ", ".join(events)
14
- # Create a single line string.
+ # Create a single line string
15
line = f"{timestamp} => {event_list_str}"
16
lines.append(line)
17
18
- # Join all lines with a newline separator.
+ # Join all lines with a newline separator
19
return "\n".join(lines)
20
21
0 commit comments