【发布时间】:2015-12-28 11:38:55
【问题描述】:
有没有比从数值中获取 unicode 字符串更好的方法
str(value).decode('utf-8')?
示例用法:
from scipy.io import wavfile
encoding = 'utf-8'
def get_data(basename):
print (basename).decode(encoding)
sampFreq, snd = wavfile.read(basename+'.wav')
print (u'sample freq: ' + str(sampFreq).decode(encoding) + ' Hz')
print (u'sample size: '+ str(snd.dtype).decode(encoding))
【问题讨论】:
标签: python python-2.7 unicode python-unicode