Python Forum
How to generate Lines from wordlist?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to generate Lines from wordlist?
#1
Hello guys,
I'm new here ^^

I have a question , So I've got a big textfile with words
I'm trying to Generate every possible combination from all of them
For example : textfile contains this words : abc , abd , abe , abh ....
this will generate
abc abd abe abh
abc abd abe abg
....
abd abc abe abh
......
every possible line for each starting word
etc etc...
(I have tried to this with crunch but it needs 1000PB ;D)
The main question is , Is there some one who created something like this And can possibly share his script?
I sometimes need 3 words per line , sometimes I need more (so I need to input how many words per line)
If there is no such a script can some one reffer me to where I should start?
Also a stop and resume would be nice! since this will take so much space I will need to constantly Delete the old one and recreate a new one.

Thanks a bunch! ^_^
Reply
#2
The itertools module has the permutations and combinations functions. They create generators, which return one combination/permutation at a time, without storing all of them in memory. You could write them to a file in append mode, and then start a new file every n-thousand lines.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  looping wordlist keeps repeating when word not found OTH 1 1,897 Feb-24-2021, 05:36 PM
Last Post: nilamo
  Iterate 2 large text files across lines and replace lines in second file medatib531 13 5,707 Aug-10-2020, 11:01 PM
Last Post: medatib531

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020