f1 = open ('file2.txt','w')
with open ('file1.txt') as f2:
while True:
st = f1.readline().replace('\n',' ')
print(st)
if not st: break
lst = st.split()
for i in lst:
if i%3 == 0:
f2.write (i+' ')
print(len())
try:
with open ('file1.txt') as f2:
print (f2.read())
except:
print('Error opening file')