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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:25:25+00:00 2026-05-22T18:25:25+00:00

First off , this isn’t a homework assignment!!! :p What I want to do

  • 0

First off , this isn’t a homework assignment!!! :p What I want to do is this:

Given a data file(be it text or numbers) saved on the desktop i.e., I want to be able to search that file and pull out only the data I want and print it to the screen. I may want to do other stuff with it but I have no idea what options there are.

Also, would python or c++ be more appropriate. I’m not familiar much with python and it’s been years since I’ve picked up c++ but I’ve heard that python is more efficient and although this program’s efficiency may or may not be a big deal I have heard python is much easier to understand.

Examples,Code, Templates(<– would be awesome)

Thanks all!

  • 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-22T18:25:26+00:00Added an answer on May 22, 2026 at 6:25 pm

    This is a bit difficult to answer without knowing how you want to specify the data you want.

    If you can specify the necessary data using regexes, Python will probably be about equally efficient, and a bit quicker to write — but you may be able to do the job with something like grep even more easily.

    If it’ll take a lot more processing to figure out what data to display, Python may start to get quite a bit slower — it can be quite fast as long as the Python part is mostly a fairly “thin” shell and most of the heavy lifting is done by various libraries. It can get quite a bit slower if you’re doing serious/significant processing in Python itself.

    If you write in in C++, you’ll get more or less the opposite situation — as long as you’re reasonably careful, chances are pretty good that performance won’t be an issue. The real question will be how much work it takes to produce what you want. Without knowing anything about what data you’re looking for, how you want to display it, etc., it’s nearly impossible to guess about that though.

    edit based on comment: A pattern like Data = #### sounds like pretty much a classic case for a regular expression, for which grep will work just fine.

    This is also something Python can probably do perfectly well, but if you did decide to do your own in C++, it could look something like this:

    #include <iostream>
    #include <string>
    #include <regex>
    #include <fstream>
    
    int main(int argc, char **argv) { 
        if (argc < 2) {
            std::cerr << "Usage: searched <filename>\n";
            return 1;
        }
    
        std::ifstream in(argv[1]);
        std::string line;
        std::regex pat("Data = [0-9]+");
    
        while (std::getline(line, in))
            if (std::regex_search(line, pat))
                std::cout << line << "\n";
        return 0;
    }
    

    This assumes you’re looking for the Data = # pattern happening somewhere in the line. If you want to only consider it a match if that’s the whole line, change the regex_search to regex_match instead.

    The other assumption is that you’re using a relatively recent compiler that includes the standard regular expression classes. This is the case with VS 2010 and gcc 4.6 (if I recall correctly) but some older compilers may name it std::tr1::regex instead, and some that are older still won’t have it at all.

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

Sidebar

Related Questions

First off, this isn't homework ;). I'm trying to create a wordsearch game from
First off this isn't for any homework question, it's just on a general type
First off: I know that this isn't reliable for actually checking if I can
Ok... First off, I know this isn't a new question. But, for some reason
First off, this isn't exactly the ideal way of setting up a page, however
Ok, first off this isn't to find a value of a select boxes selected
First off, this question is ripped out from this question. I did it because
First off the html row looks like this: <tr class=evenColor> blahblah TheTextIneed blahblah and
First off, this is NOT a duplicate of: Turn a C string with NULL
First off, I apologize if this doesn't make sense. I'm new to XHTML, CSS

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.