I have two files:
A:
John
Kevin
Richard
B:
Manager
Salesperson
Doctor
I am trying to read lines from both the files simultaneously and print the following:
Output:
John is a Manager
Kevin is a Salesperson
Richard is a Doctor
I tried using contextlib.izip package but it's not working.
Code:
with open('name') as names:
with open('job') as jobs:
for names1 in names:
jobs1 = jobs.readlines()
print names1 + jobs1
But this throws error as
`TypeError: cannot concatenate 'str' and 'list' objects`
I also tried using contextlib package but it didn't work.