Your code works correctly using lists:
def partition(l, pred):
    fid_train = []
    fid_test = []
    for e in l:
        if pred(e):
            fid_test.append(e)
        else:
            fid_train.append(e)
    return fid_train,fid_test

lines = ['{}\n'.format(i) for i in range(100)]
lines1, lines2 = partition(lines, lambda x: random.random() < 0.2)   
print(len(lines1))
> 82
print(len(lines2))
> 18

and I’m unsure why the files should fail assuming readlines() returns the expected number of lines in the source file.
Note that you are not closing the files, which is not recommended.