简单记录下,希望能帮助到有需要的同学。
python把txt文件中逗号改成空格
import sys
import math
import os
import numpy as np
import matplotlib.pyplot as plt
ls = open("in.txt").readlines()
newTxt = ""
for line in ls:
newTxt = newTxt+" ".join(line.split(","))+"\n"
print(newTxt)
fo = open("out.txt", "x")
fo.write(newTxt)
fo.close()