Getting a combination of elements using itertools

It is very convenient to use a method called itertools.product to get a list of combinations of the contents of multiple lists.

Input = ["Docment","StyleSheet","Value"]
Output = ["XML","Shema","DTD"]
Action = ["Read","Write","GetRoot","EditSubELM","EditDescELM","Append","Insert","Iterate","Find","Format"]

writeObj = list(itertools.product(Input,Output,Action))

with open("write.txt","w") as writer:
    writer.write(str(writeObj))
    writer.close()

The output result is as follows.

('Docment', 'XML', 'Read')
('Docment', 'XML', 'Write')
('Docment', 'XML', 'GetRoot')
('Docment', 'XML', 'EditSubELM')
('Docment', 'XML', 'EditDescELM')
('Docment', 'XML', 'Append')
('Docment', 'XML', 'Insert')
('Docment', 'XML', 'Iterate')
('Docment', 'XML', 'Find')
('Docment', 'XML', 'Format')
('Docment', 'Shema', 'Read')
('Docment', 'Shema', 'Write')
('Docment', 'Shema', 'GetRoot')
('Docment', 'Shema', 'EditSubELM')
('Docment', 'Shema', 'EditDescELM')
('Docment', 'Shema', 'Append')
('Docment', 'Shema', 'Insert')
('Docment', 'Shema', 'Iterate')
('Docment', 'Shema', 'Find')
('Docment', 'Shema', 'Format')
('Docment', 'DTD', 'Read')
('Docment', 'DTD', 'Write')
('Docment', 'DTD', 'GetRoot')
('Docment', 'DTD', 'EditSubELM')
('Docment', 'DTD', 'EditDescELM')
('Docment', 'DTD', 'Append')
('Docment', 'DTD', 'Insert')
('Docment', 'DTD', 'Iterate')
('Docment', 'DTD', 'Find')
('Docment', 'DTD', 'Format')
('StyleSheet', 'XML', 'Read')
('StyleSheet', 'XML', 'Write')
('StyleSheet', 'XML', 'GetRoot')
('StyleSheet', 'XML', 'EditSubELM')
('StyleSheet', 'XML', 'EditDescELM')
('StyleSheet', 'XML', 'Append')
('StyleSheet', 'XML', 'Insert')
('StyleSheet', 'XML', 'Iterate')
('StyleSheet', 'XML', 'Find')
('StyleSheet', 'XML', 'Format')
('StyleSheet', 'Shema', 'Read')
('StyleSheet', 'Shema', 'Write')
('StyleSheet', 'Shema', 'GetRoot')
('StyleSheet', 'Shema', 'EditSubELM')
('StyleSheet', 'Shema', 'EditDescELM')
('StyleSheet', 'Shema', 'Append')
('StyleSheet', 'Shema', 'Insert')
('StyleSheet', 'Shema', 'Iterate')
('StyleSheet', 'Shema', 'Find')
('StyleSheet', 'Shema', 'Format')
('StyleSheet', 'DTD', 'Read')
('StyleSheet', 'DTD', 'Write')
('StyleSheet', 'DTD', 'GetRoot')
('StyleSheet', 'DTD', 'EditSubELM')
('StyleSheet', 'DTD', 'EditDescELM')
('StyleSheet', 'DTD', 'Append')
('StyleSheet', 'DTD', 'Insert')
('StyleSheet', 'DTD', 'Iterate')
('StyleSheet', 'DTD', 'Find')
('StyleSheet', 'DTD', 'Format')
('Value', 'XML', 'Read')
('Value', 'XML', 'Write')
('Value', 'XML', 'GetRoot')
('Value', 'XML', 'EditSubELM')
('Value', 'XML', 'EditDescELM')
('Value', 'XML', 'Append')
('Value', 'XML', 'Insert')
('Value', 'XML', 'Iterate')
('Value', 'XML', 'Find')
('Value', 'XML', 'Format')
('Value', 'Shema', 'Read')
('Value', 'Shema', 'Write')
('Value', 'Shema', 'GetRoot')
('Value', 'Shema', 'EditSubELM')
('Value', 'Shema', 'EditDescELM')
('Value', 'Shema', 'Append')
('Value', 'Shema', 'Insert')
('Value', 'Shema', 'Iterate')
('Value', 'Shema', 'Find')
('Value', 'Shema', 'Format')
('Value', 'DTD', 'Read')
('Value', 'DTD', 'Write')
('Value', 'DTD', 'GetRoot')
('Value', 'DTD', 'EditSubELM')
('Value', 'DTD', 'EditDescELM')
('Value', 'DTD', 'Append')
('Value', 'DTD', 'Insert')
('Value', 'DTD', 'Iterate')
('Value', 'DTD', 'Find')
('Value', 'DTD', 'Format')

Recommended Posts

Getting a combination of elements using itertools
A memorandum of using eigen3
A memorandum of using Python's input function
Impressions of using Flask for a month
Rewriting elements in a loop of lists (Python)
Extract elements (using a list of indexes) in a NumPy style from a Python list / tuple
[Python] Implementation of clustering using a mixed Gaussian model
Cut a part of the string using a Python slice
Read a large amount of securities reports using COTOHA
Group by consecutive elements of a list in Python
Implementation of a convolutional neural network using only Numpy
I tried using Python (3) instead of a scientific calculator
Example of using lambda
Instantly create a diagram of 2D data using python's matplotlib
Implementation of VGG16 using Keras created without using a trained model
Avoiding the pitfalls of using a Mac (for Linux users?)
Reuse the behavior of the @property method by using a descriptor [16/100]
Get the number of specific elements in a python list
A memo of writing a basic function in Python using recursion
The story of creating a database using the Google Analytics API
Try using [Tails], a purveyor of hackers (?), By USB booting.
[End of 2020] A memo to start using AWS CLI (Version 2)