Find multiple elements in string in Python












1















my problem is that I need to find multiple elements in one string.



For example I got one string that looks like this:



line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))


and then i got this code to find everything between ' (" ' and ' ") '



char1 = '("'
char2 = '")'


add = line[line.find(char1)+2 : line.find(char2)]
list.append(add)


The current result is just:



['INPUT']


but I need the result to look like this:



['INPUT','OUTPUT', ...]


after it got the first match it stopped searching for other matches, but I need to find everything in that string that matches this search.



I also need to append every single match to the list.










share|improve this question

























  • @Ev.Kounis my bad

    – SilverSlash
    Nov 23 '18 at 8:40
















1















my problem is that I need to find multiple elements in one string.



For example I got one string that looks like this:



line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))


and then i got this code to find everything between ' (" ' and ' ") '



char1 = '("'
char2 = '")'


add = line[line.find(char1)+2 : line.find(char2)]
list.append(add)


The current result is just:



['INPUT']


but I need the result to look like this:



['INPUT','OUTPUT', ...]


after it got the first match it stopped searching for other matches, but I need to find everything in that string that matches this search.



I also need to append every single match to the list.










share|improve this question

























  • @Ev.Kounis my bad

    – SilverSlash
    Nov 23 '18 at 8:40














1












1








1








my problem is that I need to find multiple elements in one string.



For example I got one string that looks like this:



line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))


and then i got this code to find everything between ' (" ' and ' ") '



char1 = '("'
char2 = '")'


add = line[line.find(char1)+2 : line.find(char2)]
list.append(add)


The current result is just:



['INPUT']


but I need the result to look like this:



['INPUT','OUTPUT', ...]


after it got the first match it stopped searching for other matches, but I need to find everything in that string that matches this search.



I also need to append every single match to the list.










share|improve this question
















my problem is that I need to find multiple elements in one string.



For example I got one string that looks like this:



line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))


and then i got this code to find everything between ' (" ' and ' ") '



char1 = '("'
char2 = '")'


add = line[line.find(char1)+2 : line.find(char2)]
list.append(add)


The current result is just:



['INPUT']


but I need the result to look like this:



['INPUT','OUTPUT', ...]


after it got the first match it stopped searching for other matches, but I need to find everything in that string that matches this search.



I also need to append every single match to the list.







python






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 11 '18 at 9:56









Cœur

19.1k9114155




19.1k9114155










asked Nov 23 '18 at 8:29









M4I3XM4I3X

286




286













  • @Ev.Kounis my bad

    – SilverSlash
    Nov 23 '18 at 8:40



















  • @Ev.Kounis my bad

    – SilverSlash
    Nov 23 '18 at 8:40

















@Ev.Kounis my bad

– SilverSlash
Nov 23 '18 at 8:40





@Ev.Kounis my bad

– SilverSlash
Nov 23 '18 at 8:40












4 Answers
4






active

oldest

votes


















5














The simplest:



>>> import re
>>> s = """line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))"""
>>> r = re.compile(r'("(.*?)")')
>>> r.findall(s)
['INPUT', 'OUTPUT']


The trick is to use .*? which is a non-greedy *.






share|improve this answer



















  • 1





    This is the way to do it. +1

    – Ev. Kounis
    Nov 23 '18 at 8:44













  • Thanks, im using this now.

    – M4I3X
    Nov 23 '18 at 9:06











  • I got one more thing, how can i get the result of findall into a variable? If i try result = r.findall(s) i get this error TypeError: expected string or bytes-like object

    – M4I3X
    Nov 23 '18 at 9:15











  • Your code should work. Looks more like an encoding issue. You're Python 2 or Python 3? Check the type of your input. With something like print(my_input.__class__)

    – Samuel GIFFARD
    Nov 23 '18 at 9:22











  • I solved it, i was reading lines from a file but forgot to assign a variable to it^^

    – M4I3X
    Nov 23 '18 at 9:32



















1














You should look into regular expressions because that's a perfect fit for what you're trying to achieve.



Let's examine a regular expression that does what you want:



import re
regex = re.compile(r'("([^"]+)")')


It matches the string (" then captures anything that isn't a quotation mark and then matches ") at the end.



By using it with findall you will get all the captured groups:



In [1]: import re

In [2]: regex = re.compile(r'("([^"]+)")')

In [3]: line = 'if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'

In [4]: regex.findall(line)
Out[4]: ['INPUT', 'OUTPUT']





share|improve this answer


























  • NB: Will not work if there's a " in the string that he wants to find. Non-greedy star operator *? is the clean way to go there.

    – Samuel GIFFARD
    Nov 23 '18 at 8:48











  • That was intentional though

    – Raniz
    Nov 23 '18 at 8:49











  • Regular experssions are not generally a good fit for brackets matching. For this particular task it works, but it can break easily (or get messy) if doing something slightly more complicated. Just a heads up to the OP

    – Robin Nemeth
    Nov 23 '18 at 9:24



















0














If you don't want to use regex, this will help you.



line = 'if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'
char1 = '("'
char2 = '")'


add = line[line.find(char1)+2 : line.find(char2)]
list.append(add)
line1=line[line.find(char2)+1:]
add = line1[line1.find(char1)+2 : line1.find(char2)]
list.append(add)
print(list)


just add those 3 lines in your code, and you're done






share|improve this answer
























  • how that method will help if will be more than two ("...") in line?

    – Andrey Suglobov
    Nov 23 '18 at 8:57





















0














if I understand you correct, than something like that is help you:



line = 'line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'
items =
start = 0
end = 0
c = 0;
while c < len(line):
if line[c] == '(' and line[c + 1] == '"':
start = c + 2
if line[c] == '"' and line[c + 1] == ')':
end = c
if start and end:
items.append(line[start:end])
start = end = None
c += 1

print(items) # ['INPUT', 'OUTPUT']





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443047%2ffind-multiple-elements-in-string-in-python%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    The simplest:



    >>> import re
    >>> s = """line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))"""
    >>> r = re.compile(r'("(.*?)")')
    >>> r.findall(s)
    ['INPUT', 'OUTPUT']


    The trick is to use .*? which is a non-greedy *.






    share|improve this answer



















    • 1





      This is the way to do it. +1

      – Ev. Kounis
      Nov 23 '18 at 8:44













    • Thanks, im using this now.

      – M4I3X
      Nov 23 '18 at 9:06











    • I got one more thing, how can i get the result of findall into a variable? If i try result = r.findall(s) i get this error TypeError: expected string or bytes-like object

      – M4I3X
      Nov 23 '18 at 9:15











    • Your code should work. Looks more like an encoding issue. You're Python 2 or Python 3? Check the type of your input. With something like print(my_input.__class__)

      – Samuel GIFFARD
      Nov 23 '18 at 9:22











    • I solved it, i was reading lines from a file but forgot to assign a variable to it^^

      – M4I3X
      Nov 23 '18 at 9:32
















    5














    The simplest:



    >>> import re
    >>> s = """line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))"""
    >>> r = re.compile(r'("(.*?)")')
    >>> r.findall(s)
    ['INPUT', 'OUTPUT']


    The trick is to use .*? which is a non-greedy *.






    share|improve this answer



















    • 1





      This is the way to do it. +1

      – Ev. Kounis
      Nov 23 '18 at 8:44













    • Thanks, im using this now.

      – M4I3X
      Nov 23 '18 at 9:06











    • I got one more thing, how can i get the result of findall into a variable? If i try result = r.findall(s) i get this error TypeError: expected string or bytes-like object

      – M4I3X
      Nov 23 '18 at 9:15











    • Your code should work. Looks more like an encoding issue. You're Python 2 or Python 3? Check the type of your input. With something like print(my_input.__class__)

      – Samuel GIFFARD
      Nov 23 '18 at 9:22











    • I solved it, i was reading lines from a file but forgot to assign a variable to it^^

      – M4I3X
      Nov 23 '18 at 9:32














    5












    5








    5







    The simplest:



    >>> import re
    >>> s = """line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))"""
    >>> r = re.compile(r'("(.*?)")')
    >>> r.findall(s)
    ['INPUT', 'OUTPUT']


    The trick is to use .*? which is a non-greedy *.






    share|improve this answer













    The simplest:



    >>> import re
    >>> s = """line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))"""
    >>> r = re.compile(r'("(.*?)")')
    >>> r.findall(s)
    ['INPUT', 'OUTPUT']


    The trick is to use .*? which is a non-greedy *.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 23 '18 at 8:42









    Samuel GIFFARDSamuel GIFFARD

    390112




    390112








    • 1





      This is the way to do it. +1

      – Ev. Kounis
      Nov 23 '18 at 8:44













    • Thanks, im using this now.

      – M4I3X
      Nov 23 '18 at 9:06











    • I got one more thing, how can i get the result of findall into a variable? If i try result = r.findall(s) i get this error TypeError: expected string or bytes-like object

      – M4I3X
      Nov 23 '18 at 9:15











    • Your code should work. Looks more like an encoding issue. You're Python 2 or Python 3? Check the type of your input. With something like print(my_input.__class__)

      – Samuel GIFFARD
      Nov 23 '18 at 9:22











    • I solved it, i was reading lines from a file but forgot to assign a variable to it^^

      – M4I3X
      Nov 23 '18 at 9:32














    • 1





      This is the way to do it. +1

      – Ev. Kounis
      Nov 23 '18 at 8:44













    • Thanks, im using this now.

      – M4I3X
      Nov 23 '18 at 9:06











    • I got one more thing, how can i get the result of findall into a variable? If i try result = r.findall(s) i get this error TypeError: expected string or bytes-like object

      – M4I3X
      Nov 23 '18 at 9:15











    • Your code should work. Looks more like an encoding issue. You're Python 2 or Python 3? Check the type of your input. With something like print(my_input.__class__)

      – Samuel GIFFARD
      Nov 23 '18 at 9:22











    • I solved it, i was reading lines from a file but forgot to assign a variable to it^^

      – M4I3X
      Nov 23 '18 at 9:32








    1




    1





    This is the way to do it. +1

    – Ev. Kounis
    Nov 23 '18 at 8:44







    This is the way to do it. +1

    – Ev. Kounis
    Nov 23 '18 at 8:44















    Thanks, im using this now.

    – M4I3X
    Nov 23 '18 at 9:06





    Thanks, im using this now.

    – M4I3X
    Nov 23 '18 at 9:06













    I got one more thing, how can i get the result of findall into a variable? If i try result = r.findall(s) i get this error TypeError: expected string or bytes-like object

    – M4I3X
    Nov 23 '18 at 9:15





    I got one more thing, how can i get the result of findall into a variable? If i try result = r.findall(s) i get this error TypeError: expected string or bytes-like object

    – M4I3X
    Nov 23 '18 at 9:15













    Your code should work. Looks more like an encoding issue. You're Python 2 or Python 3? Check the type of your input. With something like print(my_input.__class__)

    – Samuel GIFFARD
    Nov 23 '18 at 9:22





    Your code should work. Looks more like an encoding issue. You're Python 2 or Python 3? Check the type of your input. With something like print(my_input.__class__)

    – Samuel GIFFARD
    Nov 23 '18 at 9:22













    I solved it, i was reading lines from a file but forgot to assign a variable to it^^

    – M4I3X
    Nov 23 '18 at 9:32





    I solved it, i was reading lines from a file but forgot to assign a variable to it^^

    – M4I3X
    Nov 23 '18 at 9:32













    1














    You should look into regular expressions because that's a perfect fit for what you're trying to achieve.



    Let's examine a regular expression that does what you want:



    import re
    regex = re.compile(r'("([^"]+)")')


    It matches the string (" then captures anything that isn't a quotation mark and then matches ") at the end.



    By using it with findall you will get all the captured groups:



    In [1]: import re

    In [2]: regex = re.compile(r'("([^"]+)")')

    In [3]: line = 'if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'

    In [4]: regex.findall(line)
    Out[4]: ['INPUT', 'OUTPUT']





    share|improve this answer


























    • NB: Will not work if there's a " in the string that he wants to find. Non-greedy star operator *? is the clean way to go there.

      – Samuel GIFFARD
      Nov 23 '18 at 8:48











    • That was intentional though

      – Raniz
      Nov 23 '18 at 8:49











    • Regular experssions are not generally a good fit for brackets matching. For this particular task it works, but it can break easily (or get messy) if doing something slightly more complicated. Just a heads up to the OP

      – Robin Nemeth
      Nov 23 '18 at 9:24
















    1














    You should look into regular expressions because that's a perfect fit for what you're trying to achieve.



    Let's examine a regular expression that does what you want:



    import re
    regex = re.compile(r'("([^"]+)")')


    It matches the string (" then captures anything that isn't a quotation mark and then matches ") at the end.



    By using it with findall you will get all the captured groups:



    In [1]: import re

    In [2]: regex = re.compile(r'("([^"]+)")')

    In [3]: line = 'if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'

    In [4]: regex.findall(line)
    Out[4]: ['INPUT', 'OUTPUT']





    share|improve this answer


























    • NB: Will not work if there's a " in the string that he wants to find. Non-greedy star operator *? is the clean way to go there.

      – Samuel GIFFARD
      Nov 23 '18 at 8:48











    • That was intentional though

      – Raniz
      Nov 23 '18 at 8:49











    • Regular experssions are not generally a good fit for brackets matching. For this particular task it works, but it can break easily (or get messy) if doing something slightly more complicated. Just a heads up to the OP

      – Robin Nemeth
      Nov 23 '18 at 9:24














    1












    1








    1







    You should look into regular expressions because that's a perfect fit for what you're trying to achieve.



    Let's examine a regular expression that does what you want:



    import re
    regex = re.compile(r'("([^"]+)")')


    It matches the string (" then captures anything that isn't a quotation mark and then matches ") at the end.



    By using it with findall you will get all the captured groups:



    In [1]: import re

    In [2]: regex = re.compile(r'("([^"]+)")')

    In [3]: line = 'if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'

    In [4]: regex.findall(line)
    Out[4]: ['INPUT', 'OUTPUT']





    share|improve this answer















    You should look into regular expressions because that's a perfect fit for what you're trying to achieve.



    Let's examine a regular expression that does what you want:



    import re
    regex = re.compile(r'("([^"]+)")')


    It matches the string (" then captures anything that isn't a quotation mark and then matches ") at the end.



    By using it with findall you will get all the captured groups:



    In [1]: import re

    In [2]: regex = re.compile(r'("([^"]+)")')

    In [3]: line = 'if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'

    In [4]: regex.findall(line)
    Out[4]: ['INPUT', 'OUTPUT']






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 23 '18 at 8:48

























    answered Nov 23 '18 at 8:46









    RanizRaniz

    8,52112356




    8,52112356













    • NB: Will not work if there's a " in the string that he wants to find. Non-greedy star operator *? is the clean way to go there.

      – Samuel GIFFARD
      Nov 23 '18 at 8:48











    • That was intentional though

      – Raniz
      Nov 23 '18 at 8:49











    • Regular experssions are not generally a good fit for brackets matching. For this particular task it works, but it can break easily (or get messy) if doing something slightly more complicated. Just a heads up to the OP

      – Robin Nemeth
      Nov 23 '18 at 9:24



















    • NB: Will not work if there's a " in the string that he wants to find. Non-greedy star operator *? is the clean way to go there.

      – Samuel GIFFARD
      Nov 23 '18 at 8:48











    • That was intentional though

      – Raniz
      Nov 23 '18 at 8:49











    • Regular experssions are not generally a good fit for brackets matching. For this particular task it works, but it can break easily (or get messy) if doing something slightly more complicated. Just a heads up to the OP

      – Robin Nemeth
      Nov 23 '18 at 9:24

















    NB: Will not work if there's a " in the string that he wants to find. Non-greedy star operator *? is the clean way to go there.

    – Samuel GIFFARD
    Nov 23 '18 at 8:48





    NB: Will not work if there's a " in the string that he wants to find. Non-greedy star operator *? is the clean way to go there.

    – Samuel GIFFARD
    Nov 23 '18 at 8:48













    That was intentional though

    – Raniz
    Nov 23 '18 at 8:49





    That was intentional though

    – Raniz
    Nov 23 '18 at 8:49













    Regular experssions are not generally a good fit for brackets matching. For this particular task it works, but it can break easily (or get messy) if doing something slightly more complicated. Just a heads up to the OP

    – Robin Nemeth
    Nov 23 '18 at 9:24





    Regular experssions are not generally a good fit for brackets matching. For this particular task it works, but it can break easily (or get messy) if doing something slightly more complicated. Just a heads up to the OP

    – Robin Nemeth
    Nov 23 '18 at 9:24











    0














    If you don't want to use regex, this will help you.



    line = 'if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'
    char1 = '("'
    char2 = '")'


    add = line[line.find(char1)+2 : line.find(char2)]
    list.append(add)
    line1=line[line.find(char2)+1:]
    add = line1[line1.find(char1)+2 : line1.find(char2)]
    list.append(add)
    print(list)


    just add those 3 lines in your code, and you're done






    share|improve this answer
























    • how that method will help if will be more than two ("...") in line?

      – Andrey Suglobov
      Nov 23 '18 at 8:57


















    0














    If you don't want to use regex, this will help you.



    line = 'if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'
    char1 = '("'
    char2 = '")'


    add = line[line.find(char1)+2 : line.find(char2)]
    list.append(add)
    line1=line[line.find(char2)+1:]
    add = line1[line1.find(char1)+2 : line1.find(char2)]
    list.append(add)
    print(list)


    just add those 3 lines in your code, and you're done






    share|improve this answer
























    • how that method will help if will be more than two ("...") in line?

      – Andrey Suglobov
      Nov 23 '18 at 8:57
















    0












    0








    0







    If you don't want to use regex, this will help you.



    line = 'if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'
    char1 = '("'
    char2 = '")'


    add = line[line.find(char1)+2 : line.find(char2)]
    list.append(add)
    line1=line[line.find(char2)+1:]
    add = line1[line1.find(char1)+2 : line1.find(char2)]
    list.append(add)
    print(list)


    just add those 3 lines in your code, and you're done






    share|improve this answer













    If you don't want to use regex, this will help you.



    line = 'if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'
    char1 = '("'
    char2 = '")'


    add = line[line.find(char1)+2 : line.find(char2)]
    list.append(add)
    line1=line[line.find(char2)+1:]
    add = line1[line1.find(char1)+2 : line1.find(char2)]
    list.append(add)
    print(list)


    just add those 3 lines in your code, and you're done







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 23 '18 at 8:41









    Sandesh34Sandesh34

    254113




    254113













    • how that method will help if will be more than two ("...") in line?

      – Andrey Suglobov
      Nov 23 '18 at 8:57





















    • how that method will help if will be more than two ("...") in line?

      – Andrey Suglobov
      Nov 23 '18 at 8:57



















    how that method will help if will be more than two ("...") in line?

    – Andrey Suglobov
    Nov 23 '18 at 8:57







    how that method will help if will be more than two ("...") in line?

    – Andrey Suglobov
    Nov 23 '18 at 8:57













    0














    if I understand you correct, than something like that is help you:



    line = 'line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'
    items =
    start = 0
    end = 0
    c = 0;
    while c < len(line):
    if line[c] == '(' and line[c + 1] == '"':
    start = c + 2
    if line[c] == '"' and line[c + 1] == ')':
    end = c
    if start and end:
    items.append(line[start:end])
    start = end = None
    c += 1

    print(items) # ['INPUT', 'OUTPUT']





    share|improve this answer




























      0














      if I understand you correct, than something like that is help you:



      line = 'line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'
      items =
      start = 0
      end = 0
      c = 0;
      while c < len(line):
      if line[c] == '(' and line[c + 1] == '"':
      start = c + 2
      if line[c] == '"' and line[c + 1] == ')':
      end = c
      if start and end:
      items.append(line[start:end])
      start = end = None
      c += 1

      print(items) # ['INPUT', 'OUTPUT']





      share|improve this answer


























        0












        0








        0







        if I understand you correct, than something like that is help you:



        line = 'line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'
        items =
        start = 0
        end = 0
        c = 0;
        while c < len(line):
        if line[c] == '(' and line[c + 1] == '"':
        start = c + 2
        if line[c] == '"' and line[c + 1] == ')':
        end = c
        if start and end:
        items.append(line[start:end])
        start = end = None
        c += 1

        print(items) # ['INPUT', 'OUTPUT']





        share|improve this answer













        if I understand you correct, than something like that is help you:



        line = 'line = if ((var.equals("INPUT")) || (var.equals("OUTPUT"))'
        items =
        start = 0
        end = 0
        c = 0;
        while c < len(line):
        if line[c] == '(' and line[c + 1] == '"':
        start = c + 2
        if line[c] == '"' and line[c + 1] == ')':
        end = c
        if start and end:
        items.append(line[start:end])
        start = end = None
        c += 1

        print(items) # ['INPUT', 'OUTPUT']






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 '18 at 8:47









        Andrey SuglobovAndrey Suglobov

        1649




        1649






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53443047%2ffind-multiple-elements-in-string-in-python%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            If I really need a card on my start hand, how many mulligans make sense? [duplicate]

            Alcedinidae

            Can an atomic nucleus contain both particles and antiparticles? [duplicate]