Friday, 6 September 2013

Python Reading a file print several information

Python Reading a file print several information

i got the following code
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
#read information
f = open ("/home/ibrahim/Desktop/Test.list")
text = f.read()
#show existing companys
Companyname = text.split("\n")
print Companyname
#User chooses a company he wants to know more about
raw_input('\n<Wählen Sie die Firma Ihrer Wahl aus um die Informationen
anzuzeigen.>\n\n<Geben Sie die Firmenspezifische Zahl ein und b$
#Companyspecific information is getting revealed
the "Test.list" looks like this
(1)Chef,1965,10
(2)Fisher,1932,20
(3)Gardener,1998,5
My aim is that the user of this program can choose a specific Company he
wants to find out more about, like for example the year this company
started and the number of employees Example: Companyname = Chef, year the
company started = 1965 and number of employees = 10 I don't want to print
more than the company's name, because the information in the future will
contain more than just the founding year and the number of employees ;) it
would be pretty confusing to see so much information ^^

No comments:

Post a Comment