Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. import math
  2. word_list = ['Cat','Dog','Bird','Goose','Llama']
  3. with open("/Users/andrewlintz/Desktop/findreplaceprocess/doc2.txt") as main, open('/Users/andrewlintz/Desktop/findreplaceprocess/doc3.txt', 'w') as new_main:
  4. counter = 0
  5. for line in main:
  6. temp = line
  7. num = int(math.floor(counter/8))
  8. counter += 1
  9. temp = temp.replace("MARKER",word_list[num])
  10. new_main.write(temp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement