FAQ
TJG- that solved the printing issue!! Many thanks:)

Thanks to Chris and Jean Michel for your hints.
On Tue, May 24, 2011 at 4:07 AM, wrote:

Send Python-list mailing list submissions to
python-list at python.org

To subscribe or unsubscribe via the World Wide Web, visit
http://mail.python.org/mailman/listinfo/python-list
or, via email, send a message with subject or body 'help' to
python-list-request at python.org

You can reach the person managing the list at
python-list-owner at python.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Python-list digest..."

Today's Topics:

1. Re: Why did Quora choose Python for its development?
(Stefan Behnel)
2. Re: Why did Quora choose Python for its development?
(Octavian Rasnita)
3. Re: Why did Quora choose Python for its development?
(Chris Angelico)
4. NEED HELP- read file contents, while loop to accept user
input, and enter to exit (Cathy James)
5. Re: NEED HELP- read file contents, while loop to accept user
input, and enter to exit (Tim Golden)
6. Re: NEED HELP- read file contents, while loop to accept user
input, and enter to exit (Chris Angelico)
7. Re: I installed Python 3 on Fedora 14 By Downloading
python3.2 bziped source tarball and install it according to the
README, Now How shall I uninstalled python 3.2? (harrismh777)
8. Re: Why did Quora choose Python for its development?
(Daniel Kluev)
9. Re: NEED HELP- read file contents, while loop to accept user
input, and enter to exit (Chris Rebert)
10. Re: [Savoynet] More 'vast heavin' (Chris Angelico)


---------- Forwarded message ----------
From: Stefan Behnel <stefan_ml at behnel.de>
To: python-list at python.org
Date: Tue, 24 May 2011 08:23:55 +0200
Subject: Re: Why did Quora choose Python for its development?
Beliavsky, 20.05.2011 18:39:
I thought this essay on why one startup chose Python was interesting.
Since everyone seems to be hot flaming at their pet languages in this
thread, let me quickly say this:

Thanks for sharing the link.

Stefan




---------- Forwarded message ----------
From: "Octavian Rasnita" <orasnita at gmail.com>
To: <python-list at python.org>
Date: Tue, 24 May 2011 11:10:36 +0300
Subject: Re: Why did Quora choose Python for its development?
From: "Stefan Behnel" <stefan_ml at behnel.de>
Beliavsky, 20.05.2011 18:39:
I thought this essay on why one startup chose Python was interesting.
Since everyone seems to be hot flaming at their pet languages in this
thread, let me quickly say this:

Thanks for sharing the link.

Maybe I have missed a message, but if I didn't, please provide that link.
I am always interested to find the best solutions.

Thanks.

Octavian




---------- Forwarded message ----------
From: Chris Angelico <rosuav at gmail.com>
To: python-list at python.org
Date: Tue, 24 May 2011 18:20:44 +1000
Subject: Re: Why did Quora choose Python for its development?
On Tue, May 24, 2011 at 6:10 PM, Octavian Rasnita wrote:
From: "Stefan Behnel" <stefan_ml at behnel.de>
Beliavsky, 20.05.2011 18:39:
I thought this essay on why one startup chose Python was interesting.
Since everyone seems to be hot flaming at their pet languages in this
thread, let me quickly say this:

Thanks for sharing the link.

Maybe I have missed a message, but if I didn't, please provide that link.
I am always interested to find the best solutions.
At the beginning of the thread, three days and forty-odd messages ago,
this was posted:

http://www.quora.com/Why-did-Quora-choose-Python-for-its-development

It's the reason for the thread title, regardless of the current thread
content :)

Chris Angelico



---------- Forwarded message ----------
From: Cathy James <nambo4jb at gmail.com>
To: python-list at python.org
Date: Tue, 24 May 2011 03:31:37 -0500
Subject: NEED HELP- read file contents, while loop to accept user input,
and enter to exit
dear mentor,

I need help with my code:
1) my program won't display file contents upon opening
2) my program is not writing to file
3) my program is not closing when user presses enter- gow do I do this with
a while loop?

please see my attempt below and help:

#1) open file and display current file contents:
f = open ('c:/testing.txt'', 'r')
f.readlines()
#2) and 3) use while loop to write user input to file, save to file,
close when press enter:
while True:
s = input ('enter name: ').strip()
f = open ('c:/testing.txt', 'a')
if f.writable():
f.write(s)
break
else:
f = open ('c:/testing.txt', 'r')
f.readlines()
for line in f:
print (line)


---------- Forwarded message ----------
From: Tim Golden <mail at timgolden.me.uk>
To:
Date: Tue, 24 May 2011 09:46:11 +0100
Subject: Re: NEED HELP- read file contents, while loop to accept user
input, and enter to exit
On 24/05/2011 09:31, Cathy James wrote:

dear mentor,
I need help with my code:
1) my program won't display file contents upon opening
#1) open file and display current file contents:
f = open ('c:/testing.txt'', 'r')
f.readlines()
If you're running this in an interactive interpreter, I would
expect it to show a list of lines (assuming c:/testing.txt has
something in it...). If you're running it as a program, though,
it won't show anything: you need to actually output the result
of the expression f.readlines (). It only happens at the
interpreter as a development convenience:

f = open ("c:/testing.txt", "r")
print f.readlines ()
# or print (f.readlines ()) if you're in Python 3

TJG



---------- Forwarded message ----------
From: Chris Angelico <rosuav at gmail.com>
To: python-list at python.org
Date: Tue, 24 May 2011 18:46:32 +1000
Subject: Re: NEED HELP- read file contents, while loop to accept user
input, and enter to exit
On Tue, May 24, 2011 at 6:31 PM, Cathy James wrote:
s = input ('enter name: ').strip()
Are you using Python 2 or Python 3? If it's Python 2, this should be
raw_input().
f = open ('c:/testing.txt', 'a')
...
f = open ('c:/testing.txt', 'r')
You may be having trouble here as a result of not closing the file and
then trying to reopen it.

Also, at some point you have to check if 's' (the user's inputted
string) is empty. You can then leave the loop using the 'break'
statement.

Hope that helps! Best of luck with your homework.

Chris Angelico



---------- Forwarded message ----------
From: harrismh777 <harrismh777 at charter.net>
To: python-list at python.org
Date: Tue, 24 May 2011 03:47:31 -0500
Subject: Re: I installed Python 3 on Fedora 14 By Downloading python3.2
bziped source tarball and install it according to the README, Now How shall
I uninstalled python 3.2?
Varuna Seneviratna wrote:
Now How shall I uninstalled
python 3.2?
Now, how shall I remove Python 3.2 ?


... very carefully.


It might be nice if there were a label in the Makefile so this would work:

sudo make removeall

... but alas, why do you want to un-install Python3.2 ?








---------- Forwarded message ----------
From: Daniel Kluev <dan.kluev at gmail.com>
To: python-list at python.org
Date: Tue, 24 May 2011 19:55:40 +1100
Subject: Re: Why did Quora choose Python for its development?
On Tue, May 24, 2011 at 5:00 PM, Octavian Rasnita wrote:
And you are telling that in Perl should be used an even more complicated and
ugly syntax just for beeing the same as in Python just for showing that I am
wrong, but I was comparing just the shortness and cleraness of the code.

So, again, in Perl is just:

%d = @l;
Once again. Suppose we have array of key-value pairs (two-dimensional
array), `l`. In python, converting it to dict is as simple as d =
dict(l). In perl, %d = @l; produces meaningless value. Following your
logic, this means that perl has ugly syntax.

--
With best regards,
Daniel Kluev



---------- Forwarded message ----------
From: Chris Rebert <clp2 at rebertia.com>
To: Cathy James <nambo4jb at gmail.com>
Date: Tue, 24 May 2011 01:58:25 -0700
Subject: Re: NEED HELP- read file contents, while loop to accept user
input, and enter to exit
On Tue, May 24, 2011 at 1:31 AM, Cathy James wrote:
dear mentor,

I need help with my code:
<snip>

In addition to what others have already said...
please see my attempt below and help:

#1) open file and display current file contents:
f = open ('c:/testing.txt'', 'r')
f.readlines()
#2) and 3) use while loop to write user input to file, save to file, close
when press enter:
while True:
s = input ('enter name: ').strip()
f = open ('c:/testing.txt', 'a')
if f.writable():
Since you *just* opened the file in append mode, this condition will
*always* be true (append mode implies writability), so your `else`
clause will *never* be executed.
f.write(s)
break
else:
f = open ('c:/testing.txt', 'r')
f.readlines()
for line in f:
print (line)
Similar beginner questions would be best directed to Python's Tutor
mailinglist: http://mail.python.org/mailman/listinfo/tutor

Cheers,
Chris



---------- Forwarded message ----------
From: Chris Angelico <rosuav at gmail.com>
To: python-list at python.org
Date: Tue, 24 May 2011 19:07:21 +1000
Subject: Re: [Savoynet] More 'vast heavin'
On Tue, May 24, 2011 at 7:03 PM, Larry Simons
wrote:
On Tue 24/05/2011 04:11, Libby Moyer wrote:

And the rhymes in Mikado!
Are you referring to ablutioner, diminutioner and ?you shun her? all rhymed
with executioner?
Can't deny that they're grin-worthy!

(Or groan-worthy, I always get those two mixed up.)

ChrisA


--
http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110524/77c2ba7c/attachment.html>

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMay 24, '11 at 6:19p
activeMay 24, '11 at 6:19p
posts1
users1
websitepython.org

1 user in discussion

Cathy James: 1 post

People

Translate

site design / logo © 2022 Grokbase