How about
header_line = ['1st column', '2nd column'] + [x for x in my_dict.keys()] + ['note']
As mentioned in the comments, for this case you can just use my_dict.keys()
or list(my_dict)
, but the above example is still useful as an example of how to do this when the list comprehension can't be trivially eliminated.