Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8190513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:40:32+00:00 2026-06-07T03:40:32+00:00

Alright, Currently, if given a string like such: A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5,(F:0.6,G:0.7)H:0.8 I am using this: child

  • 0

Alright,
Currently, if given a string like such:

A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5,(F:0.6,G:0.7)H:0.8

I am using this:

child = Pstring[Pstring.find('(')+1:Pstring.find(')')]

To iterate through the string, and print out the inner parenthesis, and assign it to the variable ‘child’

Now, my question is, how can I do the same for:

W:1.0,X:1.1(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5,(F:0.6,G:0.7)H:0.8)Y:0.9  

Which just simply contains an outside parenthesis to show that everything(except W and X) are children of Y

I currently get an output of ‘child’ as:

A:0.1,B:0.2,(C:0.3,D:0.4

Whereas what I want the code to do is to first parse through the outside parenthesis, and grab the inner ones first, then work on the outside last.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:40:34+00:00Added an answer on June 7, 2026 at 3:40 am

    If you just want the contents of the inner parentheses, you can use re.findall() with the following regular expression:

    \(([^()]*)\)
    

    For example:

    >>> import re
    >>> s = 'W:1.0,X:1.1(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5,(F:0.6,G:0.7)H:0.8)Y:0.9'
    >>> re.findall(r'\(([^()]*)\)', s)
    ['C:0.3,D:0.4', 'F:0.6,G:0.7']
    

    Explanation:

    \(        # literal '('
    (         # start capturing group
      [^()]*    # any characters except '(' and ')', any number
    )         # end capturing group
    \)        # literal ')'
    

    re.findall() returns the contents of the capturing group for each match.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, currently I'm using GD to create a PNG image that logs a few
First, the formula I'm currently using: =countifs('page1'!AF:AF,$L6,'page1'!AA:AA,=&RIGHT(M$2,3))+countifs('page1'!AF:AF,$L6,'page1'!AB:AB,=&RIGHT(M$2,3))+countifs('page1'!AF:AF,$L6,'page1'!AC:AC,=&RIGHT(M$2,3))+countifs('page1'!AF:AF,$L6,'page1'!AD:AD,=&RIGHT(M$2,3))+countifs('page1'!AF:AF,$L6,'page1'!AE:AE,=&RIGHT(M$2,3))+countifs('page1'!AF:AF,$L6,'page1'!AF:AF,=&RIGHT(M$2,3)) Alright, now, what I'm attempting to match
Alright, so I am currently trying to find all strings in a list that
Alright I don't see why this isnt working. It seems pretty simple. Here is
Alright, this is driving me nuts because my regex is working on Rubular, but
Alright so I have no idea how to even begin doing this But basically
Alright I created some custom classes for my project sourced from this tutorial ,
Alright, so I got this code for gluLookAt: lookAt = new Vector3f(-player.pos.x, -player.pos.y, -player.pos.z);
Alright, I'll try and make this brief as possible. I wanted to a UIToolbar
Alright, I know I can change the text generally speaking as such: oLanguage: {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.