Question
A python program that can replace multiple numbers in a file. Input file: next 9021435 #### 1435 Water test1 next 80269263 #### Heat st2 air
A python program that can replace multiple numbers in a file.
Input file: <>next 9021435 #### 1435 Water test1 <>next 80269263 #### Heat st2 air <>next 1002301406 ####
50236591 60241943 Heat food PC air <>next 1002301406 #### 502438102 5038120 5025910 5025910
The text below will be used to replace the number between '<>next' and '####' with the corresponding line. 9021435 152456-5-163 80269263 3956-5-173 1002301406 3456-5-183 1002301406 12564-5-12
I'm looking for someting robust, and NOT like data = data.replace('9021435', '152456-5-163') for all the values. The output will look like this: <>next 152456-5-163 #### 1435 Water test1 <>next 3956-5-173 #### Heat st2 air <>next 3456-5-183 ####
50236591 60241943 Heat food PC air <>next 12564-5-12 #### 502438102 5038120 5025910 5025910
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started