用python把一个txt文件中所有逗号,替换成空格?

 1 string = "word  2     3  4    5 6     7"
 2 string = ",".join(string.split())
 3 
 4 
 5 
 6 import numpy as np
 7 import pandas as pd
 8 a = pd.read_csv(list_landmarks_align_celeba.txt)
 9 print(a)
10 f = open("list_landmarks_align_celeba.txt","r")
11 for line in f.readlines():
12     line = ",".join(line.split())
13     print(line)
14     print(line[3])
15     # print(line[ :2])
16     # print(line[::2])

技术分享图片

 
文章来自:https://www.cnblogs.com/ansang/p/8434774.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3