Python Forum
Comparing Values/QC Within Two Strings
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Comparing Values/QC Within Two Strings
#1
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.
Reply
#2
Go ahead and show what you've tried so far.
Reply
#3
I didn't make far at all, and couldn't apply the values in the first sentence to the second sentence after the fact.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to understand strings and lists of strings Konstantin23 2 699 Aug-06-2023, 11:42 AM
Last Post: deanhystad
  Comparing List values to get indexes Edward_ 7 1,083 Jun-09-2023, 04:57 PM
Last Post: deanhystad
  Splitting strings in list of strings jesse68 3 1,704 Mar-02-2022, 05:15 PM
Last Post: DeaD_EyE
  Finding multiple strings between the two same strings Slither 1 2,482 Jun-05-2019, 09:02 PM
Last Post: Yoriz
  Comparing values in large txt files StevenVF 2 2,701 Feb-28-2019, 09:07 AM
Last Post: StevenVF
  Looping through dictionary and comparing values with elements of a separate list. Mr_Keystrokes 5 3,836 Jun-22-2018, 03:08 PM
Last Post: wavic
  Comparing values in separate lists KaleBosRatjes 3 2,981 May-02-2018, 04:38 PM
Last Post: KaleBosRatjes
  Changing User Input Strings Into Set Integer Values Mario128843 3 3,121 May-01-2018, 03:32 AM
Last Post: Mario128843
  lists, strings, and byte strings Skaperen 2 4,183 Mar-02-2018, 02:12 AM
Last Post: Skaperen
  comparing multiple values Skaperen 5 11,480 Dec-06-2017, 03:25 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020