tfw: everything is more fun with unicode
parent
8d5e750c9c
commit
72135ea0ed
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
tfw.py - the fucking weather module
|
tfw.py - the fucking weather module
|
||||||
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
|
author: mutantmonkey <mutantmonkey@mutantmonkey.in>
|
||||||
|
@ -45,16 +46,15 @@ def tfw(phenny, input, fahrenheit=False, celsius=False):
|
||||||
if c.isdigit() or c == '-':
|
if c.isdigit() or c == '-':
|
||||||
tempt += c
|
tempt += c
|
||||||
temp = int(tempt)
|
temp = int(tempt)
|
||||||
deg = chr(176)
|
|
||||||
|
|
||||||
# add units and convert if necessary
|
# add units and convert if necessary
|
||||||
if fahrenheit:
|
if fahrenheit:
|
||||||
temp = "%d%cF?!" % (temp, deg)
|
temp = "{0:d}°F‽".format(temp)
|
||||||
elif celsius:
|
elif celsius:
|
||||||
temp = "%d%cC?!" % (temp, deg)
|
temp = "{0:d}°C‽".format(temp)
|
||||||
else:
|
else:
|
||||||
tempev = (temp + 273.15) * 8.617343e-5 * 1000
|
tempev = (temp + 273.15) * 8.617343e-5 * 1000
|
||||||
temp = "%f meV?!" % tempev
|
temp = "%f meV‽" % tempev
|
||||||
|
|
||||||
# parse comment (broken by <br />, so we have do it this way)
|
# parse comment (broken by <br />, so we have do it this way)
|
||||||
comments = main[0].xpath('text()')
|
comments = main[0].xpath('text()')
|
||||||
|
|
Loading…
Reference in New Issue