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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:39:41+00:00 2026-06-14T01:39:41+00:00

I am trying to create a list based on the input below, and I

  • 0

I am trying to create a list based on the input below, and I don’t see the expected output. Can anyone suggest where am I going wrong?

INPUT:

CR  FA  CL  Title
409452  WLAN    656885  Age out RSSI values from buffer in Beacon miss scenario
415560  WLAN    656886  To Record SMD Event Logging

I want an OUTPUT like

[['CR', 'FA', 'CL', 'TITLE'], ['409452', 'WLAN', '656885', 'Age out RSSI values from buffer in Beacon miss scenario'], ['415560', 'WLAN', '656886','To Record SMD Event Logging']]

But i see its getting created like

[['CR', 'FA', 'CL', 'TITLE'], ['', '409452', 'WLAN', '656885\tAge out RSSI values from buffer in Beacon miss scenario'], ['', '415560', 'WLAN', '656886\tTo Record SMD Event Logging']]

Python code

 for i in info.splitlines():
    index = re.split(r'\W+',i,3)
    CRlist.append(index)
  • 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-14T01:39:42+00:00Added an answer on June 14, 2026 at 1:39 am

    The output you’re getting is exactly what you’d expect if there were extra whitespace at the start of each line but the first.

    One common reason for this is that you’ve tried parsing files with the wrong line endings, without using universal-newlines mode, and just gotten things hopelessly confused.

    For example, these two lines may look identical in your text editor:

    409452  WLAN    656885  Age out RSSI values from buffer in Beacon miss scenario
    \r409452  WLAN    656885  Age out RSSI values from buffer in Beacon miss scenario
    

    But your re.split will do very different things with them:

    ['409452', 'WLAN', '656885', 'Age out RSSI values from buffer in Beacon miss scenario']
    ['', '409452', 'WLAN', '656885\tAge out RSSI values from buffer in Beacon miss scenario']
    

    The solution is to strip off the excess whitespace. You can try to write a more complicated regexp, or just do re.split(r'\W+', s.lstrip(), 3).

    Since you mentioned wanting to strip trailing whitespace as well, use strip instead of lstrip: re.split(r'\W+', s.strip(), 3).

    But I’m not sure why you’re using regexp in the first place, when you could just do s.strip().split(None, 3).

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

Sidebar

Related Questions

I'm trying to create a reference based linked list anyone would be able to
I trying to create an HTML/CSS/JavaScript based list manager. I'm using text input fields
I've been trying to create a list definition based on the SharePoint Discussion Board
I'm trying to create a drop down list in an ASP.NET MVC3 view based
I'm trying to create a Linq query based on a user's input. Writing sql
I am trying to create a unique taskID list based on the selections. Each
I am trying to create a list where I want users to enter data
I'm trying to create a list of permutations of a list, such that, for
I'm trying to create UL list with images and descriptions. With 5 items in
I'm trying to create a list, with each <li> on one row. My problem

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.