string olmayan objeye takla attırmaya gerek yok

This commit is contained in:
Gürer Özen
2005-10-11 20:41:05 +00:00
parent be0696a5c1
commit e700a114fc
+4 -6
View File
@@ -151,14 +151,12 @@ valid_filetypes = [
] ]
def printu(obj): def printu(obj):
"""smart print command which handles unicode strings and objects which if isinstance(obj, unicode):
return unicode __str__'s, a common case in our implementation"""
if isinstance(obj, str):
print obj
elif isinstance(obj, unicode):
print obj.encode('utf-8') print obj.encode('utf-8')
elif isinstance(obj, str):
print obj.decode('utf-8')
else: else:
print unicode(obj).encode('utf-8') # this is printu! print str(obj)
def valuesort(x, y): def valuesort(x, y):
if x[1] > y[1]: if x[1] > y[1]: