Re: 'open' is not defined

2015-07-31 Thread dieter
writes: > What about using the append function to remove duplicate outputs entered on > or thereafter line no. 9, i.e., As far as I know, "append" does not have intelligence in this respect. Thus, if you need intelligence, your program must implement it. In cases like yours, I use a) added

Re: 'open' is not defined

2015-07-30 Thread ltc.hotspot
Dieter, Thanks. What about using the append function to remove duplicate outputs entered on or thereafter line no. 9, i.e., LIST_APPEND(i) Calls list.append(TOS[-i], TOS). Used to implement list comprehensions. While the appended value is popped off, the list object remains on the stack

Re: 'open' is not defined

2015-07-30 Thread dieter
writes: > ... > Why is open not defined in the following code:NameError: name 'open' is not > defined > > Code reads as follows: > > fname = raw_input("Enter file name: ") > if len(fname) < 1 : fname = "mbox-short.txt" > fh = open(fname) > count = 0 > for line in fh: > if not line.startswith(