Bob Gailer wrote:
> Asrarahmed Kadri wrote:
>
>> Here is the complete code:
>> fd is the file handle.
>>
>> import sys
>>
>> def check_dup(fd1):
>> print fd1
>> fd1.seek(0,0)
>> done = 0
>> list1 = []
>> while not done:
>> x = fd1.readline()
>> if x == "":
Asrarahmed Kadri wrote:
> Here is the complete code:
> fd is the file handle.
>
> import sys
>
> def check_dup(fd1):
> print fd1
> fd1.seek(0,0)
> done = 0
> list1 = []
> while not done:
> x = fd1.readline()
> if x == "":
> done = 1
> else:
> fname = raw_input("Enter the file name to write data to:\t")
>
> fd = open(fname,'a+')
> print fd
> done = 0
Ok, good, that helps a lot: that's exactly what we need to diagnose the
problem. There appears to be something funky that happens with
append-plus mode. This problem has come up befor
Asrarahmed Kadri wrote:
> Here is the complete code:
> fd is the file handle.
>
> import sys
>
> def check_dup(fd1):
> print fd1
> fd1.seek(0,0)
> done = 0
> list1 = []
> while not done:
> x = fd1.readline()
> if x == "":
> done = 1
> else
Here is the complete code:
fd is the file handle.
import sys
def check_dup(fd1): print fd1 fd1.seek(0,0) done = 0 list1 = [] while not done: x = fd1.readline() if x == "": done = 1 else:
list1.append(x) return list1
fname = raw_in
Asrarahmed Kadri wrote:
> Folks,
>
> I am trying to enter names in a file; each on a new line with this
> code, but not working:
>
> done = 0
> *while not done:
> str = raw_input("Enter login name:\t to quit type 'q': ")
> if str == 'q':
> done = 1
> else: *
> * str
>
> while not done:
>str = raw_input("Enter login name:\t to quit type 'q': ")
>if str == 'q':
> done = 1
>else:
> str = str + '\n'
> fd.write(str)
Hi Asrarahmed,
What's 'fd'? Where is it defined?
(I have a guess, but I'd rather that you show where fd is being defi
Folks,
I am trying to enter names in a file; each on a new line with this code, but not working:
done = 0
while not done: str = raw_input("Enter login name:\t to quit type 'q': ")if str == 'q': done = 1 else:
str = str + '\n'
fd.write(str)
The traceback is as un