-
Notifications
You must be signed in to change notification settings - Fork 1
/
io.py
43 lines (33 loc) · 1.32 KB
/
io.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from time import sleep
from datetime import datetime
def prompt(message):
variable = None
while variable is None:
try:
variable = float(raw_input(message))
except ValueError:
time.sleep(0)
return variable
def fileWriter(elementType, loadCase, inputLabels, inputValues, inputDims, outputLabels, outputValues, outputDims):
fileName = raw_input("Output File Name: ") + ".txt"
output = open(fileName, 'w')
project = raw_input("Project Number: ")
output.write(" Roark Equations for Stress and Strain\n")
output.write(" %s\n" %(elementType))
output.write(" %s\n" %(loadCase))
output.write("\n Program Release 20130909\n\n")
output.write("\n Project Number %s\n" %(project))
output.write(" Calculated %s\n" %(str(datetime.now())[:19]))
output.write("\n\nINPUT DATA\n\n")
for each in range(len(inputLabels)):
output.write(inputLabels[each])
output.write(str(inputValues[each]))
output.write(inputDims[each])
output.write("\n")
output.write("\n\nOUTPUT DATA\n\n")
for each in range(len(outputLabels)):
output.write(outputLabels[each])
output.write(str(outputValues[each]))
output.write(outputDims[each])
output.write("\n")
output.close()