用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])

用python把一个txt文件中所有逗号,替换成空格?_第1张图片

 

你可能感兴趣的:(用python把一个txt文件中所有逗号,替换成空格?)