comparison roundup/anypy/strings.py @ 5417:c749d6795bc2

Python 3 preparation: unichr.
author Joseph Myers <jsm@polyomino.org.uk>
date Wed, 25 Jul 2018 09:07:03 +0000
parents 56c9bcdea47f
children 55f09ca366c4
comparison
equal deleted inserted replaced
5416:56c9bcdea47f 5417:c749d6795bc2
71 """Return whether an object is a string or Unicode string.""" 71 """Return whether an object is a string or Unicode string."""
72 if _py3: 72 if _py3:
73 return isinstance(s, str) 73 return isinstance(s, str)
74 else: 74 else:
75 return isinstance(s, str) or isinstance(s, unicode) 75 return isinstance(s, str) or isinstance(s, unicode)
76
77 def uchr(c):
78 """Return the Unicode string containing the given character."""
79 if _py3:
80 return chr(c)
81 else:
82 return unichr(c)

Roundup Issue Tracker: http://roundup-tracker.org/