Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
matching a repeating string
#1
i have a single character (such as ".") in variable foo and another variable bar with a one or more repeat of a single character (such as "..."). i would like to know if foo matches all the repeats of bar. empty strings should never be considered to match. is this the best way to do that?
    if foo and bar and foo*len(bar) == bar:
        ...
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
matching a repeating string - by Skaperen - Jun-23-2022, 06:23 PM
RE: matching a repeating string - by BashBedlam - Jun-23-2022, 09:28 PM
RE: matching a repeating string - by Skaperen - Jun-23-2022, 10:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Matching string from a file tester_V 5 502 Mar-05-2024, 05:46 AM
Last Post: Danishhafeez
  Why is 2/3 not just .666 repeating? DocFro 4 746 Dec-12-2023, 09:09 AM
Last Post: buran
  repeating a user_input astral_travel 17 2,379 Oct-26-2022, 04:15 PM
Last Post: astral_travel
  if else repeating Frankduc 12 2,564 Jul-14-2022, 12:40 PM
Last Post: Frankduc
  Matching multiple parts in string fozz 31 6,518 Jun-13-2022, 09:38 AM
Last Post: fozz
  Matching Exact String(s) Extra 4 1,973 Jan-12-2022, 04:06 PM
Last Post: Extra
  Random Number Repeating Tzenesh 5 4,096 Jan-13-2021, 10:00 PM
Last Post: deanhystad
  factorial, repeating Aldiyar 4 2,847 Sep-01-2020, 05:22 PM
Last Post: DPaul
  number repeating twice in loop JonnyEnglish 3 3,338 Nov-24-2019, 09:23 AM
Last Post: ThomasL
  Repeating equations Tbot100 2 3,299 May-29-2019, 02:38 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

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