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])
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_alig...
//本程序读入
文件
,将
文件
中
的','替换为' ',然后保存为另一
文件
//#define src_name "in.
txt
"
//#define dst_name "out.
txt
"
int main()
char src_name[100],dst_name[100];
FILE *ifp, *ofp;
int ch;
long begin,end;
printf("please enter the source file:");
scanf("%s",src_name);//scanf("%S\n",src_name);不能加'\n'
printf("please enter the destination file:");
scanf("%s",dst_name);
if(ifp =fopen(src_name,"r")){
printf("opened src_file\n");
if(ofp =fopen(dst_name,"w+")){
printf("opened dst_file\n");
printf("changing........\n");
begin =time(NULL);
ch =fgetc(ifp);
while(ch!=EOF){
if(ch==',')ch=' ';
if(fputc(ch,ofp)==EOF){
printf("error while writing!");
return -1;
ch=fgetc(ifp);
// fputc(ch,ofp);
end =time(NULL);
printf("the consumed time:%d\n",end-begin);
printf("It's OK!\n");
fclose(ifp);
fclose(ofp);
return 0;
import matplotlib.pyplot as plt
ls = open("/home/sjj/Vins-fusion-gps/data/douhao.
txt
").readlines()
new
Txt
= ""
for line in ls:
new
Txt
= new
Txt
+" ".join(line.split(","))+"\n"
print