python读取文件(下图为部分截图),行内容有交易金额,也有其它内容
过滤掉非交易金额行:if not i.startswith("2023") and i.strip()!="\n" and not i.startswith("退"):
对交易金额行进行强转float做统计
但是有特殊字符行,所以报如下错:
解决方案:过滤前,去除字符即可,i.strip('\ufeff')
python读取文件(下图为部分截图),行内容有交易金额,也有其它内容
过滤掉非交易金额行:if not i.startswith("2023") and i.strip()!="\n" and not i.startswith("退"):
对交易金额行进行强转float做统计
但是有特殊字符行,所以报如下错:
解决方案:过滤前,去除字符即可,i.strip('\ufeff')