Making combinations in python
问题 I have four values age = 23 gender = "M" city ="Delhi" religion = "Muslim" I need these arranged by every combination with empty values like - 23 * * * 23 M * * 23 M Delhi * 23 M Delhi Muslim * M * * * M Delhi * * M Delhi Muslim * * Delhi * * * Delhi Muslim * * * Muslim * * * * I need this arranged by the number of dimensions in ascending order in a list. So combinations with one value should be on top. I have some 30+ attributes, so i need an automated way to do this in Python Any ideas ?