Created
September 28, 2021 19:34
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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