16 lines
450 B
Python
16 lines
450 B
Python
from datetime import datetime as dt
|
|
|
|
def timer(t, label):
|
|
duration = dt.now() - t
|
|
duration = duration.total_seconds()
|
|
print("{} took {}".format(label, duration))
|
|
return duration
|
|
|
|
def write_gcode(output_file_name, data):
|
|
|
|
t1 = dt.now()
|
|
with open(output_file_name, 'w+') as output_file:
|
|
for i in data:
|
|
output_file.write(i + "\n")
|
|
print(f"writing to {output_file_name}")
|
|
timer(t1, "writing file ") |