Hi I was wondering if it is possible to process 2 different files with one function and store the strings/lines I'm searching for in different variables as for instance number1 for file 1 and number 2 for file 2.
the code so far:
import string
Name = raw_input("Filename ")
infile = open(Name, 'r')
data = infile.readlines()
def getdata(data):
listing = []
for line in data:
new_line = string.split(line)[:2]
listing.append(new_line)
number = len(listing)
items = listing
def main():
number, items = getdata(data)
The problem is that I want to get number1 and itmes1 or number 2 and items2 if data = data1 or data = data2 and another problem is that I get an error message:
TypeError: 'NoneType' object is not iterable
when I call main()
Thanks for ideas,
awa