How to write a simple program in Python (opening files and parsing text)

    Question by:



    I recently was asked to become familar with Python.  I figure the best way to do that is to take a simple application in C/C++ and make it work in Python.  Hence, my questions are these:

    1)  What makes Python different from C/C++?
    2)  Will Python perform the same basic functions as C/C++ like opening files and string manipulations
    3)  Is there an editor available for download that will enable me to test a product or do I need to purchase one?

    Good Question?

    Featured Post

    Course: Foundations of Front-End Development

    Jump-start a lucrative career in front-end web development, with zero previous coding experience required. This course covers the basic programming concepts and languages required for creating engaging websites from scratch.

    Top Expert Contributor

    Essential articles and videos from the Experts

    Strings in Python are the set of characters that, once defined, cannot be changed by any other method like replace. Even if we use the replace method it still does not modify the original string that we use, but just copies the string and then modif…
    The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
    Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
    Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

    More valuable questions with Expert answers

    Question: Hello everybody... I am building some kind of small virtual printer with python. I read all data coming from a serial port in ASCII format and I can save into a file the prints coming. I'd need to find a method to correctly separate one...

    Answer: You should probably detect control characters related to the Start of TeXt (STX) and End of TeXt (ETX) -- see , for example.

    Question: I am analyzing the additions and deletions to a previous customer order. The analysis produces a summary COUNTER evaluation - for example, added = ({10: 3, 11: 5, 12: 8, 13: 5}) - where the keys are the course numbers ordered and the values...

    Answer: Is the source code really the code, that you execute? The error message (the back trace) does not seem to match your code. I don't see a call to confirmpurchase() in line 300 According to the error message you seem to call the function ...

    Question: I'm a Python developer but not a Django developer. I'm trying to get a feel for how, and how difficult, it would be to change the attached code from accepting JPGs files via the API to accepting PDF files. Currently it errors when accepting...

    Answer: Ok. Considering the code that you have presented, I would say that 8 hours should be enough. The breakdown for this effort would be something like this: - 2 hours for RCA (Root Cause Analysis) - 0.5 hours for unit test planning - 3 hours coding...

    Question: Running SQLServer 2014 Express on Windows 7. When i run netstat -aon i do not see 1433 included in the list of ports. When I try testing from a laptop with telnet machine 1433 there is no connection, but if i telnet machine 3306 or some of the...

    Answer: The connect more probably is tsql -H Axum\SQLExpress -U sa -P Imaster but only if the instance name is SQLExpress. You should go and look into the MSSQL installation of that server to make sure a) SQL Browser runs, if there is any port used...


    Extend your technology team with the Experts Exchange community.

    — trusted by —

    Who answers my questions?Our community has technology experts around the world.




    Expert in:

    • Mac OS X
    • Apple OS
    • Linux
    • Apple Hardware
    • Apple Networking




    Expert in:

    • Mac OS X
    • Apple Hardware
    • Apple OS
    • Apple Software
    • Apple Networking






    Expert in:

    • Oracle Database
    • Databases-Other
    • Python






    Expert in:

    • Python
    • C++
    • Programming-Other
    • Programming Languages-Other
    • Scripting Languages

    Pasha Kravtsov






    Raghu Mutalikdesai





    RELATED TOPICS view all topics

    1. Scripting Languages
    2. Programming-Other
    3. Programming Languages-Other
    4. Linux
    5. Perl
    6. MySQL Server
    7. Shell Scripting
    8. PHP
    9. VB Script
    10. Java