def _get_filesystem_encoding(): """Return the encoding used by the filesystem.""" from sys import getdefaultencoding as _getdefaultencoding, getfilesystemencoding as _getfilesystemencoding encoding = _getfilesystemencoding() if encoding is None: encoding = _getdefaultencoding() return encoding
s = message * times return len(s) if count else s if __name__ == '__main__': import clime.now ########NEW FILE######## __FILENAME__ = reverse #!/usr/bin/env python # -*- coding: utf-8 -*- from sys import getfilesystemencoding as _getfilesystemencoding ENCODING = _getfilesystemencoding() def reverse(x): '''We assume it is a helper function for something else. It returns True to let other stuff work. ''' if not isinstance(x, basestring): x = unicode(x) if isinstance(x, str): x = unicode(x, ENCODING) print x[::-1].decode(ENCODING)
#!/usr/bin/env python # -*- coding: utf-8 -*- from sys import getfilesystemencoding as _getfilesystemencoding ENCODING = _getfilesystemencoding() def reverse(x): '''We assume it is a helper function for something else. It returns True to let other stuff work. ''' if not isinstance(x, basestring): x = unicode(x) if isinstance(x, str): x = unicode(x, ENCODING) print x[::-1].decode(ENCODING) return x if __name__ == '__main__': import clime clime.start(ignore_return=True)