Re: 'open' is not defined

2015-07-31 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: [Tutor] Mailbox

2015-07-30 Thread ltc.hotspot
Hi Cameron, New revision code: count = 0 fn = raw_input(Enter file name: ) if len(fn) 1 : fname = mbox-short.txt for line in fn: if 'From' in line.split()[0]: count += 1 print There are %d lines starting with From % count print len(line) fn = open(fname) print There were, count, lines in the

Re: How to rearrange array using Python?

2015-07-30 Thread ltc.hotspot
Hi Mark, I’m still confused because line 4 reads: fh=open(fname,'r') # Open a new file handle, not fn = open(fname) Can you write down line by line from error to correction? Hal Sent from Surface From: Mark Lawrence Sent: ‎Thursday‎, ‎July‎ ‎30‎, ‎2015 ‎3‎:‎21‎ ‎PM To:

'open' is not defined

2015-07-30 Thread ltc.hotspot
Hi Everyone: 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('From'):

String Attribute

2015-07-29 Thread ltc.hotspot
Hi Everyone: What is the source of the syntax error to the String Attribute? Go to the following URL links and view a copy of the raw data file code and sample data: 1.) http://tinyurl.com/p2xxxhl 2.) http://tinyurl.com/nclg6pq Here is the desired output: stephen.marqu...@uct.ac.za

Help Command Question

2015-07-29 Thread ltc.hotspot
Hi Everyone, I'm trying to print a command of list options by using the help command in the iPython interpreter. Read captured copy of the printout as follows: 'Python 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 16:44:52) [MSC v. 1500 64 bit (AMD64)] Type copyright, credits or

line error on no. 7

2015-07-29 Thread ltc.hotspot
Hi Everyone, I'm writing python code to read a data text file, split the file into a list of words using the split(function) and to print the results in alphabetical order. The raw python code is located at http://tinyurl.com/oua9uqx The sample data is located at http://tinyurl.com/odt9nhe