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 639 Mar-05-2024, 05:46 AM
Last Post: Danishhafeez
  Why is 2/3 not just .666 repeating? DocFro 4 854 Dec-12-2023, 09:09 AM
Last Post: buran
  repeating a user_input astral_travel 17 2,628 Oct-26-2022, 04:15 PM
Last Post: astral_travel
  if else repeating Frankduc 12 2,832 Jul-14-2022, 12:40 PM
Last Post: Frankduc
  Matching multiple parts in string fozz 31 6,944 Jun-13-2022, 09:38 AM
Last Post: fozz
  Matching Exact String(s) Extra 4 2,066 Jan-12-2022, 04:06 PM
Last Post: Extra
  factorial, repeating Aldiyar 4 2,944 Sep-01-2020, 05:22 PM
Last Post: DPaul
  Repeating equations Tbot100 2 3,383 May-29-2019, 02:38 AM
Last Post: heiner55
  repeating for loop Kaldesyvon 5 3,988 Dec-06-2018, 08:00 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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