Misc Cleanup Update

This commit is contained in:
2019-07-04 18:39:01 +02:00
parent 0269c384da
commit 841d47e9c1
7 changed files with 95 additions and 87 deletions

View File

@@ -11,11 +11,15 @@ from datetime import date
import multiprocessing import multiprocessing
# randomI function which creates each file # randomI function which creates each file
def randomI(units, rows, rowLength, partstart): def randomI(units, rows, rowLength, partstart):
for setcounter in range(0, units): for setcounter in range(0, units):
writeFile(generateFile(rows, rowLength), setcounter, partstart) writeFile(generateFile(rows, rowLength), setcounter, partstart)
# Function for generating the content of one single file # Function for generating the content of one single file
def generateFile(rows, rowLength): def generateFile(rows, rowLength):
content = [] content = []
for y in range(0, rows): for y in range(0, rows):
@@ -23,6 +27,8 @@ def generateFile(rows, rowLength):
return content return content
# Function for generating the content of one single row randomly # Function for generating the content of one single row randomly
def generateRow(rowLength): def generateRow(rowLength):
row = "" row = ""
for z in range(0, rowLength): for z in range(0, rowLength):
@@ -30,12 +36,15 @@ def generateRow(rowLength):
return row return row
# Function for writing data into a file # Function for writing data into a file
def writeFile(content, setcounter, partstart): def writeFile(content, setcounter, partstart):
filenumber = int(setcounter) + int(partstart) filenumber = int(setcounter) + int(partstart)
file = open("testdata/file" + str(filenumber) + ".txt", "w") file = open("testdata/file" + str(filenumber) + ".txt", "w")
for w in range(0, len(content)): for w in range(0, len(content)):
file.write(content[w] + "\n") file.write(content[w] + "\n")
if __name__ == '__main__': if __name__ == '__main__':
# Getting the user input # Getting the user input
print("Hello World") print("Hello World")

View File

@@ -16,9 +16,8 @@
# Importing the time for benchmarking purposes # Importing the time for benchmarking purposes
import time import time
from datetime import date
# CODE (FUNCTIONS) # CODE
# EXECUTION # EXECUTION