I do have a file `f1` which has words and an emotional values (values from +6 to -6)

```
normal  0
sad -2
happy   4

```

I have another file `f2` which has texts (tweets) containing say average of 4 or 5 words (line by line).

I want to read text in `f2` line by line and for each line, for every word I have to search whether it is there in `f1`. If it is, then I have to get the value and add it. Likewise I have to sum values for every word (if it is in the list) in the sentence and print it.
So print should be like this (for example for first three lines)

```
3
0
-2

```

I have a code like this.I am getting error "value error:mixing iterating and read method will loose data" Please correct the code or at least give a new method to do this.

```
f2=open("file2.txt","r")
for line in f2:
    l=f2.readline()
    afinn = dict(map(lambda (k,v): (k,int(v)),[ line.split('\t') for line in open("file1.txt") ]))
    value= sum(map(lambda word: afinn.get(word, 0), l.lower().split()))
    print value
f1.close()
f2.close()

```