pep.py/helpers/generalFunctions.py

23 lines
386 B
Python
Raw Normal View History

2016-04-19 17:40:59 +00:00
"""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)