Mar-09-2018, 04:57 AM
Just want to know why str keyword is passed in isinstance() method?
def to_str(data): if isinstance(data, str): return data elif isinstance(data, bytes): return data.decode(‘utf-8’) else: raise TypeError(‘Must supply str or bytes, ‘ ‘found: %r’ % data)