Envirophat tutorial question


In https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-enviro-phat
it mentions:
You may also want to add a timestamp to your readings. You can do this with something like the following:

import datetime

timestamp = datetime.datetime.now().isoformat()
Well, yes, I do want to timestamp every entry into the log, but I have not figured out how the example provided can help me achieve this.
Basically every time the readings are logged, I want a date and timestamp to be on the same lineā€¦
I have tried adjusting the out.write() to include a strftime string but I get ValueError: unsupported format character y
and when i try to do it in another way:
TypeError: %d format: a number is required not module,
and also:
TypeError: float argument required, not module.
This is the last step to finish my project!


You should definitely read through this:



Thanks, is there a way to get the readings to 2 decimal places?




Thank you! I found a solution using %.2f