Browse Source

added escaped newlines in the string

master
ccl 3 years ago
parent
commit
f8a531b905
  1. 14
      api.py

14
api.py

@ -119,20 +119,22 @@ def api_args():
if 'rq' in request.args: if 'rq' in request.args:
rqstr = str(request.args['rq']) rqstr = str(request.args['rq'])
if rqstr == "generate": if rqstr == "generate":
# Create an empty list for our results
results = [] api_phrase_str = ''
api_phrase = []
for i in range(len(seedTextList)): for i in range(len(seedTextList)):
# Current word in the seed phrase # Current word in the seed phrase
current = seedTextList[i] current = seedTextList[i]
# Going through the letters in the above word # Going through the letters in the above word
api_phrase = []
for y in range(len(current)): for y in range(len(current)):
testKey = str(y) + current[y] testKey = str(y) + current[y]
# print(current[y],random.choice(toChooseFrom[testKey])) # print(current[y],random.choice(toChooseFrom[testKey]))
api_phrase.append(random.choice(toChooseFrom[testKey])) api_phrase.append(random.choice(toChooseFrom[testKey]))
api_phrase_str = ' \n '.join(api_phrase) api_phrase_str_word = ' '.join(api_phrase)
results.append(api_phrase_str) api_phrase_str = api_phrase_str + '\\n' + api_phrase_str_word
api_phrase_str_word = ''
api_phrase_str = api_phrase_str[2:]
print(api_phrase_str)
for elem in refWords: for elem in refWords:
if elem in api_phrase: if elem in api_phrase:
count +=1 count +=1

Loading…
Cancel
Save