1

This is for an irc quizbot. I'm trying to pick out the answers for a question. I'm fine if there is only 1 answer, but i'm confounded by multiple answers. Tried searching for answers to my problem, but to no avail.

For example, the format is "A child born to two Goa'uld hosts is known as a _________*Harsisis*Harseseus*Harsesis"

Where *Harsisis*Harseseus*Harsesis are the three possible answers.

I wanna pick out the question and the answers and put them into a tuple which goes into a list.

I want this to end up as [('A child born to two Goa'uld hosts is known as a _________','Harsisis','Harseseus','Harsesis')]

Here's what i think should be right, but it isn't working :(

re.findall(r'(.+)[*(.+)]+', file)

The solution is probably easy, but i'm fumbling.

1 Answer 1

1

To me, it looks like you just need .split():

>>> s.split('*')
    ["A child born to two Goa'uld hosts is known as a _________",
 'Harsisis',
 'Harseseus',
 'Harsesis']
Sign up to request clarification or add additional context in comments.

1 Comment

Splendid ! That was way easier than i thought :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.