Question: I want a python program that can read find and replace numbers in a text files. The first file (input text) file look like this.
I want a python program that can read find and replace numbers in a text files.
The first file (input text) file look like this.
12345 -OE-0128122D 26 26 0 1 0 0 0 0 0999 V2000 M END
12345
####
HOLOE
457789612 -OE-0128122D 26 26 0 1 0 0 0 0 0999 V2000 M END
457789612
#####
HKOL
12345 -OE-0128122D 26 26 0 1 0 0 0 0 0999 V2000 M END
12345
The second file will have the actual number and the replacement number and each replacement number will be used twice and it's unique, but we may have a duplicate of the initial number on another line. The second file will look like this:
12345 0120034545
457789612 7805780345
12345 78032
The output file will look like this.
0120034545 -OE-0128122D 26 26 0 1 0 0 0 0 0999 V2000 M END
0120034545
####
HOLOE
7805780345 -OE-0128122D 26 26 0 1 0 0 0 0 0999 V2000 M END
7805780345
#####
HKOL
12345 -OE-0128122D 26 26 0 1 0 0 0 0 0999 V2000 M END
78032
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
