字符串中有不能编码的字符
#coding:utf-8
string1=u"凝固粉末冶金技术"
print string1
f = open('data.txt','w')
f.write(string1.encode(encoding='gbk', errors='ignore'))
f.close()
#errors = 'ignore' 当编码转换出错时忽略错误
f = open('data.txt','r')
for line in f.readlines():
line.decode('gbk',errors='ignore')
print line
f.close()