How can a covert an string containing the extended ascii to represent a number raised to a power while retaining the exponent value? For example, if the string is 'm\xb3/h' which is intended to represent cubic meters per hour, I would like to return the string 'm3/h'. Or 'm\xb2' should return 'm2'.
The code -
varUnit = 'm\xb3/h'
varUnit.decode('ascii', 'ignore').endcode('ascii')
print varUnit
returns 'm/h' while 'm3/h' is desired.