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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:59:51+00:00 2026-06-13T03:59:51+00:00

So I’m trying to parse raw strings into a list (many actually) so let’s

  • 0

So I’m trying to parse raw strings into a list (many actually) so let’s say I have:

|[nothing detected] www.neopets.com/
        |status: (referer=http://www.google.com)saved 55189 bytes /fetch_d4cd213a56276ca726ddd437a1e75f1024ab7799
        |file: fetch_d4cd213a56276ca726ddd437a1e75f1024ab7799: 55189 bytes
        |file: decoding_367af53b4963986ecdeb9c09ce1a405b5b1ecd91: 68 bytes
        |[nothing detected] (script) images.neopets.com/js/common.js?v=6
            |status: (referer=http://www.google.com)saved 1523 bytes /fetch_8eeadcc08d4cb48c02dedf18648510b75190d1d7failure: [Errno 13] Permission denied: '/tmp/tmpsha1_8d7fb3ff1ef087c7ea2bf044dee294735a76ed4b.js'
            |file: fetch_8eeadcc08d4cb48c02dedf18648510b75190d1d7: 1523 bytes

And it follows a similar pattern so on and so forth. Let’s assume the depth of tabs is at most 3. I’m trying to find a way to parse this into each sublist, so in this particular case it would be a list containing the first ‘nothing detected’ followed by a list containing status, file, file, and a list containing the next nothing detected along its status/file result. (I know my wording isn’t the best, sorry). Thanks!

So far, I’ve tried counting the ‘\t’ in each line, and iterating through the whole thing, but I’m pretty confused since I can’t go back in my iteration.

  • 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-13T03:59:52+00:00Added an answer on June 13, 2026 at 3:59 am

    I think you want a data structure which can be traversed each way — i.e. a list which knows about the list that contains it — Here’s my attempt:

    s = """|[nothing detected] www.neopets.com/
    \t|status: (referer=http://www.google.com)saved 55189 bytes /fetch_d4cd213a56276ca726ddd437a1e75f1024ab7799
    \t\t|file: fetch_d4cd213a56276ca726ddd437a1e75f1024ab7799: 55189 bytes
    \t\t|file: decoding_367af53b4963986ecdeb9c09ce1a405b5b1ecd91: 68 bytes
    \t\t|[nothing detected] (script) images.neopets.com/js/common.js?v=6
    \t\t\t|status: (referer=http://www.google.com)saved 1523 bytes /fetch_8eeadcc08d4cb48c02dedf18648510b75190d1d7failure: [Errno 13] Permission denied: '/tmp/tmpsha1_8d7fb3ff1ef087c7ea2bf044dee294735a76ed4b.js'
    \t\t|file: fetch_8eeadcc08d4cb48c02dedf18648510b75190d1d7: 1523 bytes""".splitlines()
    
    class MyList(list):
        def __init__(self, parent):
            self.parent = parent
            list.__init__(self)
    
    top = current = MyList(None)
    ntab_old = 0
    for line in s:
        ntab = line.count('\t') #may need to be more robust to get tabs only at beginning
        if(ntab_old > ntab):
            #go up ntab_old - ntab levels.
            for _ in range(ntab_old - ntab):
                current = current.parent
        elif(ntab_old < ntab):
            #increased indentation means we want a new list
            current.append(MyList(current))
            current = current[-1]
        current.append(line)
        ntab_old = ntab
    
    print top
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.