Created
January 14, 2019 00:38
-
-
Save rebane2001/e65daa246d71f0b103b6ca6f675daf86 to your computer and use it in GitHub Desktop.
lorem ipsum generator for bad code challenge: https://www.reddit.com/r/badcode/comments/abi4hd/bad_code_coding_challenge_1_lorem_ipsum/ee0le1h/
This file contains 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
#NOTE = ONLY WORKS IN PYTHON 3 (MAYBE WORKS IN PYTHON 2 I HAVNe' TESTED") | |
import os | |
import sys | |
import urllib.request | |
print("Supports INFINITE LENGHT (unlimited)") | |
len = input("Enter how many letters do you want (no support for words in 1.0 version yet):") | |
File_Name = "lorem.txt" | |
OUTPUTXT = "" | |
urllib.request.urlretrieve ("https://en.wikipedia.org/wiki/Lorem_ipsum", File_Name) | |
with open("lorem.txt","r") as loremtxt1: | |
with open("lorem2.txt","w") as loremtxt2: | |
loremtxt2.write(loremtxt1.read()[12406:12850]) | |
with open("lorem2.txt","r") as loremtxt1: | |
with open("lorem.txt","w") as loremtxt2: | |
loremtxt2.write(loremtxt1.read()) | |
while 1==1: | |
try: | |
with open("lorem.txt","r") as loremtxt: | |
OUTPUTXT = loremtxt.read()[:int(len)] | |
c = -1 | |
for a in int(len)*'a': | |
c+=1 | |
b = a + OUTPUTXT[c] | |
except: | |
File_Name = File_Name + "1" | |
urllib.request.urlretrieve ("https://en.wikipedia.org/wiki/Lorem_ipsum", File_Name) | |
with open("lorem.txt","a") as l1: | |
with open(File_Name,"r") as l2: | |
l1.write(l2.read()[12406:12850]) | |
OUTPUTXT = "" | |
if OUTPUTXT == "": | |
1+1 | |
else: | |
break | |
print(OUTPUTXT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment