How to Creating text File using Python?

Creating instances from lines of a text file (Java)?

  • I have a fairly large project due tonight and I'm stuck. Right now I have to read the lines in a text file that looks like WMU University 269-544-3232 [email protected] Chicago WMU University 269-544-3232 [email protected] Detroit WMU University 269-544-3232 [email protected] Laredo WMU University 269-544-3232 [email protected] Austin Bronson Hospital 269-533-3333 [email protected] Madison Bronson Hospital 269-533-3333 [email protected] Austin Bronson Hospital 269-533-3333 [email protected] Chicago Bronson Hospital 269-533-3333 [email protected] Lansing etc... I know how to read from a text file and all of that, but I need to Read a record from the phone book input file Create an instance with this record (info from file) Use the equals() method to compare infoFromFile with the target instance If there is a match, display the infoFromFile instance by using the toString() method I think this means I have to create instances for every line, with the values from each line separated into different variables and then compare the instances. I just don't know how to create the instances. The lab says something about using the Copy() method but as far as I can tell it doesn't exist and I don't know how to make one, and then I don't know how it would even help. please help <3

  • Answer:

    As you don't know the number of the lines. It's better each time you get lines one by one and then compare it with what you have! You can make instances if you know the exact number of the instances you want to make!

nkarasch at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

As you don't know the number of the lines. It's better each time you get lines one by one and then compare it with what you have! You can make instances if you know the exact number of the instances you want to make!

Ziba

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.