Apr-11-2021, 08:48 PM
The first line creates an empty dict and assigns it to the name
The third line is a list comprehension, a compact way of gathering the output of a looping construct in a list. The line could be "unrolled" and replaces something like this:
job_args
.The third line is a list comprehension, a compact way of gathering the output of a looping construct in a list. The line could be "unrolled" and replaces something like this:
temp_list = [] for arg_str in args.job_args: temp_list.append(arg_str.split("=")) job_args_tuples = temp_listThe fourth line is similar, but it is a dict comprehension instead of a list comprehension.
temp_dict = {} for a in job_args_tuples: temp_dict[a[0]] = a[1] job_args = temp_dict