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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:27:30+00:00 2026-06-15T12:27:30+00:00

I have a txt file that looks something like this: =-=-=-=-=-=-=-=-=-=-=\n data report =-=-=-=-=-=-=-=-=-=-=\n

  • 0

I have a txt file that looks something like this:

=-=-=-=-=-=-=-=-=-=-=\n

data report

=-=-=-=-=-=-=-=-=-=-=\n

\n

\n

=-=-=-=-=-=-=-=-=-=-=\n

data report

=-=-=-=-=-=-=-=-=-=-=\n

\n

\n

…and so forth

I want to be able to extract each data report and do a variety of things to it (such as print a specific # that sits as a key value in some other dictionary I have, write it to another file, etc.). How would I go about doing this? I’ve been trying to learn Regex to help out, but it’s been confusing as I’m new to python, please help!

  • 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-15T12:27:31+00:00Added an answer on June 15, 2026 at 12:27 pm

    You can read the entire file into a string, split on the =-=-=… string, and strip the leading and trailing whitespace off of your reports like this:

    s = open(filename).read()
    reports = [x.strip() for x in s.split('=-=-=-=-=-=-=-=-=-=-=\n')]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ID.txt file that looks like this: http://something.net/something-ak/41389_718783565_1214898307_q.jpg http://something.net/something-ak/372142_106502518141813_1189943482_q.jpg and so on
I have a string from reading a .txt file that looks something like this:
I have a txt file that looks something like this ----------------------------------- RUNNING PROCESSES -----------------------------------
I have a CMakeLists.txt file that looks like this: add_executable(exec1 exec1.c source1.c source2.c source3.c)
I have a file that looks something like this. Kate Johnny Bill Kermit I
I have a tab delimited file that looks something like this: foo 0 4
I have a file (called print_1012720.txt ) that looks like the text shown below.
I have a directory that looks like this: pages/ folder1/ folder1.filename1.txt folder1.filename2.txt folder2/ folder2.filename4.txt
I have a .txt that looks like this: uc007ayl.1 ENSMUSG00000041439 uc009mkn.1 ENSMUSG00000031708 etc. my
I have a file that looks like this: A B C D E 0

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.