if six.PY2 and isinstance(word, unicode):
return s.encode(encoding)
elif six.PY3 and isinstance(word, str):
return s.encode(encoding) // bytes must be in utf8
return s.decode(encoding).encode(encoding)
After Change
"""Convert the string to binary"""
if isinstance(s, six.text_type):
return s.encode(encoding)
elif isinstance(s, six.binary_type):
// make sure the binary is in required encoding
return s.decode(encoding).encode(encoding)
else:
raise ValueError("Can only convert types {0} and {1}".format(six.text_type, six.binary_type))
def get_filenames(root, prefix=u"", suffix=u""):