我有文件a.txt,内部为:aaa = bbb,ccc = ddd,eee = fff,。而且我有多个文件(b.txt,c.txt ...),它们类似于:aaa = ggg,asd = fsd,eee = hhh,。我想创建一个新文件combine.txt,该文件将尝试在“ =”符号之前找到相同的字符串,并用“ =”符号之后的另一个文件中的数据替换它们。因此,如果我们看起来很出色,则新文件(combine.txt)如下所示: (也许有更好的方法:D),但是我是编程的新手,所以我需要帮助:)file1 = open("/home/xxx/Desktop/Input1").read().split(" = ")
for line in a:
Type = line.split(" = ")
a1 = Type[0]
c = Type[1]
file2 = [open("/home/xxx/Desktop/Input2").read()];
for line in file2:
Type = line.split(" = ")
a2= Type[0]
d = Type[1]
output = open("/home/xxx/Desktop/Output1").write();
if(a1 == a2):
print(a1 + ' = ' + d)
我有一个文件a.txt,里面是:aaa = bbb,ccc = ddd,eee = fff ,。而且我有多个文件(b.txt,c.txt ...),它们类似于:aaa = ggg,asd = fsd,eee = hhh ,.我想创建新文件Combine.txt ...