删除unicode字符

时间:2015-10-09 12:14:23

标签: python file unicode

我想从csv文件中删除井号(£

f = open('menu.csv')
    content = f.read()
    content.decode("utf-8")
    print content
    content.decode("utf-8").replace(u"\u00a3", "*")

    content.decode("utf-8").replace(u"\u00a3", "*").encode("utf-8")

但是当我打印它时,内容根本不会改变。它返回相同的字符串。

3 个答案:

答案 0 :(得分:2)

更新content

content=content.decode("utf-8").replace(u"\u00a3", "*")

答案 1 :(得分:0)

您不需要此编码/解码业务:

private int GetNumber()
{
    return GetNumber();
}

答案 2 :(得分:0)

to print pound sign you should open file with encodigns flag ..

with open('data.csv', encoding='utf-8') as f: