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"
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
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
Thanks, I’ll need some time to review your notes
Sent from Surface
From: Martin A. Brown
Sent: Tuesday, July 28, 2015 4:41 PM
To: ltc.hots...@gmail.com
Cc: Tutor@python.org
Hello again,
> The raw python code is located at http://tinyurl.com/oua9uqx
It is not very long
Hi Everyone,
How do I file in the empty list at 0 on line # 3 to produce the desired output:
The first goal of the program is to produce an output from the date list file
as following:
stephen.marqu...@uct.ac.za
lo...@media.berkeley.edu
zq...@umich.edu
rjl...@iupui.edu
zq...@umich.e
Hi Everyone:
I have a second and unrelated question:
I tried to work backward to see if there is a logic error associated with a
variable is being skipped over:
#top of code, initialize variable
output_list = ["default"]
#rest of code
If you get at the end
print output_lis
Sent from Surface
From: ltc.hots...@gmail.com
Sent: Thursday, July 30, 2015 11:47 AM
To: Steven D'Aprano
Hi Steve:
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.spl
Hi everyone,
Revised code:
fname = raw_input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.txt" # assign fname
fh=open(fname,'r') # Open a new file handle
for line in fh:
print line
if 'From' in line.split()[0] and '@' in line: sender = line.split()[1]
fn.seek
sure
Sent from Surface
From: Mark Lawrence
Sent: Thursday, July 30, 2015 3:25 PM
To: Tutor@python.org
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listi
Hi Mark,
I’m still confused because line 4 reads: fh=open(fname,'r') # Open a new
file handle, not fn = open(fname)
Therefore, can you write down line by line from error to correction?
Here is the revised code:
fname = raw_input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-shor
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'): continue
Hi Alan,
I rewrote the code 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'): continue
line2 = line.strip()
line3 = line2.split()
line4 = lin
Hi Emile,
I hope this answers your question?
Question: How do I remove each duplicate line output?
Here is the raw data code:
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('
Hi Alan,
Here is the revised code below:
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'): continue
line2 = line.strip()
line3 = line2.split()
line4 = line3[1]
Hi Martin,
Hal is not have a great day, indeed to day:
Here is the raw data entered:
fname = raw_input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.txt"
fh = open(fname)
count = 0
addresses = set()
for line in fh:
line2 = line.strip()
line3 = line2.split()
line4 = line3[
Emile,
--> Captured is a printout from line3 to addresses, below:
In [46]: print line3
[]
In [47]: print line2.split()
[]
In [48]: print line2
In [49]: print line.strip()
In [50]: print fh
In [51]: print addresses
set(['1.0', 'sou...@collab.sakaiproject.org;', 'Jan', 'mail.umich.ed
Sent from Surface
From: Alan Gauld
Sent: Friday, July 31, 2015 4:54 PM
To: Tutor@python.org
On 31/07/15 19:57, ltc.hots...@gmail.com wrote:
> for line in fh:
> line2 = line.strip()
> line3 = line2.split()
> line4 = line3[0]
You need to check that there actually
17 matches
Mail list logo