Python Forum
Comparing Values/QC Within Two Strings - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Comparing Values/QC Within Two Strings (/thread-28157.html)



Comparing Values/QC Within Two Strings - uttadms31 - Jul-07-2020

I'm quality controlling output within a Python file method. What I want to do is if I have two consecutive sentences in the code that both end with periods (.), first sentence starts with "First" and next sentence starts with "Second", make any number values in the "Second" sentence no higher than the highest number value found in the "First" sentence. I've tried using re.sub and sed but cannot get this working. Here's an example:

Input:
First sentence lists numbers 3 and 4. Second sentence shows a value of 5 and also a 6.

Output:
First sentence lists numbers 3 and 4. Second sentence shows a value of 4 and also a 4.


RE: Comparing Values/QC Within Two Strings - bowlofred - Jul-07-2020

Go ahead and show what you've tried so far.


RE: Comparing Values/QC Within Two Strings - uttadms31 - Jul-07-2020

I didn't make far at all, and couldn't apply the values in the first sentence to the second sentence after the fact.