Skip to content

Instantly share code, notes, and snippets.

@emiliodallatorre
Created September 28, 2021 19:34
Show Gist options
  • Save emiliodallatorre/f461185382d3f7f1e5e1cbf29c6c8ab8 to your computer and use it in GitHub Desktop.
Save emiliodallatorre/f461185382d3f7f1e5e1cbf29c6c8ab8 to your computer and use it in GitHub Desktop.
Un semplice script per un cronometro da laboratorio che tiene traccia delle misurazioni fatte.
from datetime import datetime
measures: list = []
while True:
print()
key: str = input(
"Premi un tasto qualsiasi per avviare il conteggio, \"r\" per fermare le misurazioni ")
if key == "r":
break
start: datetime = datetime.now()
input("Premi un tasto qualsiasi per fermare il conteggio")
end: datetime = datetime.now()
measures.append(end - start)
print(f"{len(measures)} {measures[-1]}")
# Togliere il primo numero
with open("measures.txt", "w") as f:
for measure in measures:
f.write(str(measure) + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment