Python - lines from files - all combinations -
I have two files - both prefix.txt and terms.txt have 100 lines I Cartesian Products
- I would like to write one-third file with about 10000 lines.
What is
"post-text" itemprop = "text ">
You itertools.product .
For the above, the word is required in itertools.product (open ('prefix .txt'), open ('terms.txt')): print (prefix.strip () + Term.strip ()) Print them, or submit them, or write them directly. You need .strip () , because each of them comes with.
After that, you can randomize them. Shuffle (list (open ('open with a third file' .txt ')), but I do not know what size you are using , How fast one of his files will be.
Comments
Post a Comment