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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:57:22+00:00 2026-05-15T16:57:22+00:00

i use this code to split a data to make a list with three

  • 0

i use this code to split a data to make a list with three sublists.
to split when there is * or -. but it also reads the the \n\n *.. dont know why?
i dont want to read those? can some one tell me what im doing wrong?
this is the data

*Quote of the Day
-Education is the ability to listen to almost anything without losing your temper or your self-confidence – Robert Frost
-Education is what survives when what has been learned has been forgotten – B. F. Skinner
*Fact of the Day
-Fractals, an important part of chaos theory, are very useful in studying a huge amount of areas. They are present throughout nature, and so can be used to help predict many things in nature. They can also help simulate nature, as in graphics design for movies (animating clouds etc), or predict the actions of nature.
-According to a recent survey by Just-Eat, not everyone in The United Kingdom actually knows what the Scottish delicacy, haggis is. Of the 1,623 British people polled:\n\n * 18% of Brits thought haggis was some sort of Scottish animal.\n\n * 15% thought it was a Scottish musical instrument.\n\n * 4% thought it was a character from Harry Potter.\n\n * 41% didn’t even know what Scotland’s national dish was.\n\nWhile a small number of Scots admitted not knowing what haggis was either, they also discovered that 68% of Scots would like to see Haggis delivered as takeaway.
-With the growing concerns involving Facebook and its ever changing privacy settings, a few software developers have now engineered a website that allows users to trawl through the status updates of anyone who does not have the correct privacy settings to prevent it.\n\nNamed Openbook, the ultimate aim of the site is to further expose the problems with Facebook and its privacy settings to the general public, and show people just how easy it is to access this type of information about complete strangers. The site works as a search engine so it is easy to search terms such as ‘don’t tell anyone’ or ‘I hate my boss’, and searches can also be narrowed down by gender.
*Pet of the Day
-Scottish Terrier
-Land Shark
-Hamster
-Tse Tse Fly
END

i use this code:

contents = open("data.dat").read()
data = contents.split('*') #split the data at the '*'

newlist = [item.split("-") for item in data if item]

to make that wrong similar to what i have to get list

  • 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-05-15T16:57:23+00:00Added an answer on May 15, 2026 at 4:57 pm

    The “\n\n” is part of the input data, so it’s preserved in python. Just add a strip() to remove it:

    finallist = [item.strip() for item in newlist]
    

    See the strip() docs: http://docs.python.org/library/stdtypes.html#str.strip

    UPDATED FROM COMMENT:

    finallist = [item.replace("\\n", "\n").strip() for item in newlist]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 535k
  • Answers 535k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Tau, Check out www.datatables.net. It's a Jquery plugin that reformats… May 17, 2026 at 1:09 am
  • Editorial Team
    Editorial Team added an answer Use double backslashes (c:\\Doc ...), or better yet, use forward… May 17, 2026 at 1:09 am
  • Editorial Team
    Editorial Team added an answer http://trac.symfony-project.org/browser/plugins/sfDoctrineGuardPlugin/branches/1.3/lib/model/doctrine/PluginsfGuardUser.class.php#L33 public function setPassword($password) { if (!$password && 0 ==… May 17, 2026 at 1:09 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

We use GUIDs for primary key, which you know is clustered by default. When
In the quest to make my data more accessible, I want to store my
This is related to the question I asked at How to make an AJAX
dear all..i've a textfield, it using barcode scanner for input data..after scan it shows
I am a graduate student with many scripts, bibliography data in bibtex, thesis draft
I have the following snippets of code. Basically what I'm trying to do is
I'm building an offline C# application that will import data off spread sheets and
I am hitting a lot of different sites to get a list of information
I'm trying to write a parser for the EDI data format, which is just
Ok so, i have this site that i am putting together in the play

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.