Question: I want to compare the value of 1800 with the values exist in the txt file. but code gave the **ValueError: invalid literal for int() with base 10: ''** error, i don't understand this.  

code is 

```
file=open("C:/Python26/freq.txt")
f2 = open("count.txt",'w')
contents=file.read();
for t in contents:
    if int(t)>1800:
        f2.write(" 0\n")
    else:
        f2.write("1 \n")
f2.close()

```

txt file contains the different frequencies which are as below

```
764
2297
3060
13098
1210
2680
2266
493

```

Answer: 
The exception `ValueError: invalid literal for int() with base 10` means that the value you passed to `int()` is not an integer. You read all the file as a string with `file.read()`, that's the mistake. You should read the file line by line using the loop `for t in file` and convert each line alone.

Here is my correction for the whole code:

```python
#opening files
f1 = open("C:/Python26/freq.txt")
f2 = open("count.txt",'w')

# loop through the content 
for line in f1:
    if int(line)>1800:
        f2.write("0")
    else:
        f2.write("1")

# closing files
f1.close()
f2.close()

```

I assumed that your `freq.txt` contains one number by line like this:

```
3234
23
12
78
678
33788

```
```
file=open("C:/Python26/freq.txt")
f2 = open("count.txt",'w')
contents=file.read();
tokens = nltk.word_tokenize(contents)
for t in tokens:
    if int(t)>1800:
        f2.write(" 0\n")
    else:
        f2.write("1 \n")
f2.close()

```