i seem to have a problem with readlines()as below
i have
global f
f=open("hello.t xt", "r")
f1 = open("C:\\log1. txt",'w')
f2 = open("C:\\log2. txt",'w')
def new1():
for line in f.readlines():
if line.find('new' )>= 0:
f1.write("%s" %line)
def new2():
for line in f.readlines():
if line.find('abc' )>= 0:
f2.write("%s" %line)
new1()
new2()
i don't seem to get an output for new2 ,i mean it doesn't go through the for loop
Am i doing anything wrong ??
i have
global f
f=open("hello.t xt", "r")
f1 = open("C:\\log1. txt",'w')
f2 = open("C:\\log2. txt",'w')
def new1():
for line in f.readlines():
if line.find('new' )>= 0:
f1.write("%s" %line)
def new2():
for line in f.readlines():
if line.find('abc' )>= 0:
f2.write("%s" %line)
new1()
new2()
i don't seem to get an output for new2 ,i mean it doesn't go through the for loop
Am i doing anything wrong ??
Comment