On 02Mar2022 08:29, Larry Martell <larry.mart...@gmail.com> wrote: >On Tue, Mar 1, 2022 at 7:32 PM Rob Cliffe <rob.cli...@btinternet.com> wrote: >> I think itertools.product is what you need. >> Example program: >> >> import itertools >> opsys = ["Linux","Windows"] >> region = ["us-east-1", "us-east-2"] >> print(list(itertools.product(opsys, region))) > >This does not work if region = []. I wrote in question that either >list could be empty.
What do you want to get if a list is empty? You haven't said. My personal expectation would be an empty result. Alternatively, if you expect an empty list to imply some single default the the experession: the_list or (the_default,) might be of use. Cheers, Cameron Simpson <c...@cskk.id.au> -- https://mail.python.org/mailman/listinfo/python-list