pep.py/generalFunctions.py
2016-04-19 19:40:59 +02:00

23 lines
386 B
Python

"""Some functions that don't fit in any other file"""
def stringToBool(s):
"""
Convert a string (True/true/1) to bool
s -- string/int value
return -- True/False
"""
return (s == "True" or s== "true" or s == "1" or s == 1)
def hexString(s):
"""
Output s' bytes in HEX
s -- string
return -- string with hex value
"""
return ":".join("{:02x}".format(ord(c)) for c in s)