Skip to content

Instantly share code, notes, and snippets.

Last active September 7, 2016 00:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
""" Input file: .csv with kw1, kw2, biz name, location, ST
Output: 160 chars or less of word-replaced random combo of 1st, 2nd, 3rd sentence. Length <= 160 chars
import random
import csv
firstSentence = ["Interested in KW1? ", "Looking for KW1? ", "Considering KW1? ", "Searching for KW1 in LOCATION, ST? "];
secondSentence = ["BIZNAME specializes in KW2 in the LOCATION area. ","BIZNAME is an expert in KW2 in LOCATION, ST. ","BIZNAME performs this procedure in the LOCATION, ST area. ","Explore the website BIZNAME, who performs KW2 in the LOCATION area. "];
thirdSentence = ["Click here for photos!","Click here for before and after photos!","Find more info here!","Contact us today!"];
outputFile = open('output.txt', 'w')
def replaceStrings(myList):
l = []
s = ''.join(l)
s = s.replace("KW1", myList[0])
s = s.replace("KW2", myList[1])
s = s.replace("BIZNAME", myList[2])
s = s.replace("LOCATION", myList[3])
s = s.replace("ST", myList[4])
if len(s) < 160:
s = s + '\n\n'
print (s)
with open('inputSample.csv', 'rb') as f:
reader = csv.reader(f)
for row in reader:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment