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 8169987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:01:33+00:00 2026-06-06T21:01:33+00:00

was wondering if I could get a little help with a bit of code

  • 0

was wondering if I could get a little help with a bit of code I’ve produced shown here:

if re.search(r"\b2ProcessorsRequested\b", output):                  
    corelist.append("2")                                        
elif re.search(r"\b4ProcessorsRequested\b", output):
     corelist.append("4")
elif re.search(r"\b8ProcessorsRequested\b", output):
     corelist.append("8")
elif re.search(r"\b16ProcessorsRequested\b", output):
     corelist.append("16")
elif re.search(r"\b32ProcessorsRequested\b", output):
     corelist.append("32")
elif re.search(r"\b64ProcessorsRequested\b", output):
     corelist.append("64")
elif re.search(r"\b128ProcessorsRequested\b", output):
     corelist.append("128")
elif re.search(r"\b256ProcessorsRequested\b", output):
     corelist.append("256")
elif re.search(r"\b512ProcessorsRequested\b", output):
     corelist.append("512")
elif re.search(r"\b1024ProcessorsRequested\b", output):
     corelist.append("1024")
else:
     corelist.append("1")

The problem with this code is obviously a lot of it’s repeated and also it means I can only search for a set list of cores (1,2,4 etc). How do I go about converting this code so it simply just loops from 1-1024? I thought it’d be something along the lines of this:

x=0
while x < 1025:
  if re.search(r"\b", x, "ProcessorsRequested\b", output):                  
      corelist.append(x)
      break()
x+=1 

But I think the syntax is wrong as it says (can’t remember exact wording) that I couldn’t pass more than 3 parameters in the regex part. Any help would be great! I hope I’ve made sense and if you need any more information then please ask.

  • 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-06T21:01:36+00:00Added an answer on June 6, 2026 at 9:01 pm

    Fix your regular expression to search for all of them, and tell you the number:

    corelist = [m.group(1) for m in
                re.finditer(r"\b([0-9]+)ProcessorsRequested\b", output)]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if i could get a little help modifying a piece of
I was wondering if I could get a little bit of guidance with Javascript.
Wondering if you could guys help me a little bit as I am messing
I was wondering if i could get some help. What i am trying to
Hi sorry still learning here and slow to learning code arguments. Just wondering could
I was wondering if someone could help me with a little issue I'm having.
I'm wondering if there is a little bit of code that would do something
Was wondering if someone could help me out a little with this query: SELECT
Wondering if I could get some advice and direction on this following requirement: Need
I need to do the following and i was wondering if i could get

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.