Created
July 7, 2019 17:51
-
-
Save timothy-allan/73fd19b53ddd05771b3ecb4d286b0308 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
Created on Sat Jul 6 14:33:28 2019 | |
@author: timallan | |
""" | |
import random | |
origFile = open('/Users/timallan/Desktop/whiteFang/WhiteFangOriginal.txt', 'r') | |
saveFile = open('/Users/timallan/Desktop/whiteFang/wF_03.txt', 'w') | |
origLines = origFile.readlines() | |
cutLines = [] | |
for aLine in origLines: | |
cutLine = [] | |
singleLineList = aLine.split() | |
for aWord in singleLineList: | |
randNum = random.randrange(0, 101) | |
if randNum > 59: | |
cutLine.append(aWord) | |
cutString = ' '.join(cutLine) | |
cutLines.append(cutString) | |
cutFinalString = '\n'.join(cutLines) | |
print(cutFinalString) | |
print(len(cutFinalString)) | |
saveFile.write(cutFinalString) | |
origFile.close() | |
saveFile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment