• 0

Trying to find a way to multiply 2 lists of words ....


Question

If I have a list of Towns, and a list of things you can do in those towns, for example

Towns:

Manchester

Hyde

Salford

Activities:

Swimming

Running

Sleeping

I need to find an easy way (using office or a free program preferably) to multiply them into 1 list of all possible outcomes, in this case it would be :

Swimming Manchester

Swimming Hyde

Swimming Salford

Running Manchester

Running Hyde

Running Salford

Sleeping Manchester

Sleeping Hyde

Sleeping Salford

I did this manually, but List 1 is Huge and List 2 pretty big, I dong want to spend all day copying and pasting.

If you are wondering why its so I can populate Cuterank with all of the keywords which are relevant for my websites so that I can track them. In the past I have done it manually but its getting too much.

Thanks in advance.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I will try Concatenate as I have excel to hand, I don't have SQL setup but could set it up if required.

Thanks Muchly.

Link to comment
Share on other sites

  • 0

If you have python, this will do it:

list1 = """
Apple
Banana
Car
""".strip().split("\n")

list2 = """
Red
Blue
""".strip().split("\n")

for x in list1:
	for y in list2:
		print x, y

this outputs

me$ python test.py 
Apple Red
Apple Blue
Banana Red
Banana Blue
Car Red
Car Blue

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.