[英]How to replace words in a column of a file reading other File in Python?
我在第二列中有一个包含一些医院名称的数据文件。 如果名称与其他文件中提到的模式匹配,则需要将替换文件中的值替换为替换文件中的值。 以下是文件格式详细信息
输入文件:
SourceID|医院名称|城市|国家 1|ABC 医院|德里|印度 2|XYZ 医院|浦那|印度 3|医院|孟买|印度 4|123 医院|孟买|印度
参数文件:我有另一个文件,其中提到了医院名称替换。 下面是替代品
ABC 医院 = ABC 医院 XYZ 医院 = XYZ 药房
Hosp = Hosp 3. 预期 output
SourceID|HospName|City|Country
1|ABC Hospital|Delhi|India
2|XYZ Pharmacy|Pune|India
3|Hosp|Mumbai|India
4|123 Hosp|Mumbai|India
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.