I need to combine a string with a list of strings so that I can use it as a dictionary key Can I
This list will be small (typically 1, but sometimes 2 or 3 items).
What is the fastest way to do this?
ago:
my_string == "foo" my_list == ["bar", "falcon", "quax", "etc."] After:
my_tuple == ("foo", "bar", "baz", "qux", "etc") (Note: my_list should not change itself).
I can not talk for performance, but this is definitely the simplest, I can think I:
my_tuple = tuple ([my_string] + my_list)
Comments
Post a Comment