[Python-hu] timestamp beilleszt�se

Szekeres Istv�n szekeres at iii.hu
2017. Jan. 30., H, 15:42:05 EST


out.write('*%s* %f\t%s\t%s\t%f\t%f\t%f\n' % (*timestamp, *lux, rgb, acc,
heading, temp, press))

2017-01-30 20:28 GMT+00:00 Kerti Bal�zs G�bor via Python-hu <
python-hu at python.org>:

> _______________________________________________
> Python-hu mailing list
> Python-hu at python.org
> https://mail.python.org/mailman/listinfo/python-hu
>
>
> ---------- Forwarded message ----------
> From: "Kerti Bal�zs G�bor" <kerti.balazs at mkk.szie.hu>
> To: python-hu at python.org
> Cc:
> Date: Mon, 30 Jan 2017 21:28:19 +0100
> Subject: timestamp beilleszt�se
> Kedves Lista tagok!
>
> Van egy Enviro pHAT amit egy Raspberry Pi zero-hoz csatoltam.
>
> Az
>
> https://learn.pimoroni.com/tutorial/sandyj/getting-started-
> with-enviro-phat
>
> oldal szerint be is �zemeltem, �s kezd�snek egy enviro_logger.py f�jlt
> futtatok a
>
> python enviro_logger.py
>
> utas�t�ssal.
>
> A f�jl tartalmaz:
>
> import time
> from envirophat import light, motion, weather, leds
>
> out = open('enviro.log', 'w')
> out.write('light\trgb\tmotion\theading\ttemp\tpress\n')
>
> try:
>     while True:
>         lux = light.light()
>         leds.on()
>         rgb = str(light.rgb())[1:-1].replace(' ', '')
>         leds.off()
>         acc = str(motion.accelerometer())[1:-1].replace(' ', '')
>         heading = motion.heading()
>         temp = weather.temperature()
>         press = weather.pressure()
>         out.write('%f\t%s\t%s\t%f\t%f\t%f\n' % (lux, rgb, acc, heading,
> temp, press))
>         time.sleep(60)
>
> except KeyboardInterrupt:
>     leds.off()
>     out.close()
>
> Az enviro.log f�jl kimenet�nek els� k�t sora:
> light                 rgb                     motion heading
> temp                press
> 5.000000        153,102,51 -0.11981201171875,0.18646240234375,1.04229736328125
> 241.800000 -3.760940       101324.863498
>
> Szeretn�m betenni az �n. "timestamp"-et a kimenet els� �r�k�nek.
>
> import datetime
>
> timestamp = datetime.datetime.now().isoformat()
>
> paranccsal tudok, de elakadtam ott, hogy az
>
> out.write('%f\t%s\t%s\t%f\t%f\t%f\n' % (lux, rgb, acc, heading, temp,
> press))
>
> sorba, ezt hogy �rjam be, hogy ez legyen a kimenet, b�r a m�sodperchez
> (51.041608 ) nem ragaszkodok.
>
> time                                                        light
> rgb                     motion          heading temp                press
> 2017-01-30 20:22:51.041608            5.000000 153,102,51
> -0.11981201171875,0.18646240234375,1.04229736328125 241.800000 -3.760940
>      101324.863498
>
> Tudna valaki seg�teni?
>
> El�re is k�sz�n�m!
> Bal�zs
>
>
--------- k�vetkez� r�sz ---------
Egy csatolt HTML �llom�ny �t lett konvert�lva...
URL: <http://mail.python.org/pipermail/python-hu/attachments/20170130/4ee84f95/attachment.html>


További információk a(z) Python-hu levelezőlistáról