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

 
posted @ 2018-02-09 11:28  ayew  阅读(2425)  评论(0编辑  收藏  举报