Ģ (smejmoon) rakstīja koderi kopienā, |
def fillShit(): import random f = file("shitfile.txt", "w") lines = [] for i in range(1416): lines += [str(random.random()) * random.randint(1, 10)] f.write("\n".join(lines)) f.close() def newShit(): shitBox = [] for line in file("shitfile.txt", "r"): shitBox.append(line.rjust(2048)) f = file("newshit.txt", "w") f.write("\n".join(shitBox)) f.close() import time bull = 50 start = time.time() for i in range(bull): fillShit() newShit() end = time.time() print str((end-start)/bull)
Nopūsties: