SHARE
TWEET

Untitled

a guest Jul 18th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Sat Jul  6 14:33:28 2019
  5.  
  6. @author: timallan
  7. """
  8. import random
  9.  
  10. origFile = open('/Users/timallan/Desktop/whiteFang/WhiteFangOriginal.txt', 'r')
  11. saveFile = open('/Users/timallan/Desktop/whiteFang/wF_03.txt', 'w')
  12.  
  13. origLines = origFile.readlines()
  14.  
  15. cutLines = []
  16.  
  17. for aLine in origLines:
  18.     cutLine = []
  19.     singleLineList = aLine.split()
  20.    
  21.     for aWord in singleLineList:
  22.        
  23.         randNum = random.randrange(0, 101)
  24.         if randNum > 59:
  25.             cutLine.append(aWord)
  26.         cutString = ' '.join(cutLine)
  27.        
  28.     cutLines.append(cutString)
  29.  
  30. cutFinalString = '\n'.join(cutLines)
  31.  
  32.  
  33. print(cutFinalString)
  34. print(len(cutFinalString))
  35. saveFile.write(cutFinalString)
  36.  
  37. origFile.close()
  38. saveFile.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top