0

how to find the second question in strings???

30th Oct 2016, 12:20 PM
LegendaryGaming
LegendaryGaming - avatar
2 ответов
+ 2
https://code.sololearn.com/cIi14FFULifV import re text = "- Hello! How are you?\n- I'm fine. And you?" #original text print(text) strings = text.split("?") strings = [s + "?" for s in strings if s!=""] questions = [] for str in strings: for sentence in re.split('\. |! |\.|!|- |-|\n', str): if(sentence[-1:] == '?'): questions.append(sentence) print("\nSecond question is: ") print (questions[1]) # print second question
30th Oct 2016, 8:07 PM
Vladimir Honcharenko
Vladimir Honcharenko - avatar
+ 1
<<"\""
31st Oct 2016, 4:17 PM
abhijith
abhijith - avatar