Alexander Ramadan

Where I Sometimes Write Stuff

Keyword Permutator in Python

I use a pretty great permutator tool at work that lets you enter endless numbers of keywords and making permutations of those keywords, but I didn’t have something at home I could use on OSX. That’s why I decided to put my limited Python skills to work to create this simple keyword permutator.

It’s extremely basic but does the trick in a pinch. It works like this, grab the scrip from Github here, then run the script from the command line like:

You need to have Python already installed on your computer for this to work.

Open the Terminal Tool and CD into the directory where you downloaded the file.

import sys def permutations(): list_1 = [i for i in sys.argv[1:]] list_2 = [i for i in sys.argv[1:]] for i in list_1: for x in list_2: if x != i: print i + " " + x

Next it asks you to fill in your first keyword

Name your keyword list -

Currently you can enter up to 2 lists and 3 keywords each. Once you fill in all 6 keywords it will create a .txt with all the permutations of those 6 keywords named whatever you set it to name it a few steps back.

enter your first keyword -

As you can see it’s extremely limited, and there are probably better options out there but this was more of an exercise to help me with my Python by creating something useful for myself.

In the future I’d like make the following up grades:

-Ability to add endless amounts of keywords without having to edit the source -Have unbalanced numbers of keywords in each list, so maybe 5 in list 1 and 6 in list 2 -Ability to have more lists of keywords -Not have to edit the source code anytime I need additional keywords or lists

It’s available on Github right now, so feel free to grab it and use it here. If you’re inclined please make it better!