[Tutor] rstrip in list?

2010-02-09 Thread Ken G.
I printed out some random numbers to a list and use 'print mylist' and they came out like this: ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] I was using 'print mylist.rstrip()' to strip off the '\n' but kept getting an error of : AttributeError: 'list' object has no attribute

Re: [Tutor] Closing a matplotlib window after show()

2010-02-09 Thread zhengqing gan
: 5fc821071002081854k2fa92309ned9389b9f3d91...@mail.gmail.com Content-Type: text/plain; charset=iso-8859-1 python -- next part -- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/tutor/attachments/20100209/a46c4683/attachment-0001.htm

Re: [Tutor] rstrip in list?

2010-02-09 Thread Steven D'Aprano
On Wed, 10 Feb 2010 02:28:43 am Ken G. wrote: I printed out some random numbers to a list and use 'print mylist' and they came out like this: ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] I was using 'print mylist.rstrip()' to strip off the '\n' but kept getting an error of :

Re: [Tutor] rstrip in list?

2010-02-09 Thread Ken G.
Kent Johnson wrote: On Tue, Feb 9, 2010 at 10:28 AM, Ken G. beach...@insightbb.com wrote: I printed out some random numbers to a datafile and use 'print mylist' and they came out like this: ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] How are you generating this list? You

Re: [Tutor] rstrip in list?

2010-02-09 Thread bob gailer
Ken G. wrote: I printed out some random numbers to a list and use 'print mylist' and they came out like this: ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n'] I was using 'print mylist.rstrip()' to strip off the '\n' but kept getting an error of : AttributeError: 'list' object has no

Re: [Tutor] rstrip in list?

2010-02-09 Thread Kent Johnson
On Tue, Feb 9, 2010 at 11:09 AM, Ken G. beach...@insightbb.com wrote: Kent Johnson wrote: On Tue, Feb 9, 2010 at 10:28 AM, Ken G. beach...@insightbb.com wrote: I printed out some random numbers to a datafile and use 'print mylist' and they came out like this: ['102\n', '231\n', '463\n',

Re: [Tutor] rstrip in list? (SOLVED)

2010-02-09 Thread Ken G.
There was so many different solutions presented here to me. Thanks to all. By adding '.strip('\n') to the last two lines below, it came out: Sorted List ['102', '231', '463', '487', '555', '961'] for line in file.readlines(): print line.strip('\n'), mylist.append(line.strip('\n'))

[Tutor] Embarrassed...

2010-02-09 Thread Ken G.
I am a little embarrassed. I just happen to found a program I wrote in December that create random numbers into a file, copy the numbers into a list, print the numbers unsorted and sorted from the list without printing '\n'. Nevertheless, I do thanks you all for trying to help me out. Ken

Re: [Tutor] Closing a matplotlib window after show()

2010-02-09 Thread Wayne Watson
Form me the solution is getting into interactive mode, which I had never heard of until this morning. On 2/9/2010 9:04 AM, Wayne Watson wrote: Well, you are correct. Finally, my latest post to the MPL list caught the eye of John Hunter. I think he wrote MPL. The way out is interactive use.

[Tutor] apache2.2 - django deployment

2010-02-09 Thread Joson
Hi all, I wanna deploy a django program on apache2.2. So I downloaded mod_wsgi-win32-ap22py26-3.0.so and copied it into apache2.2/modules/, renamed mod_wsgi.so. in httpd.conf I appended sentence: LoadModule python_module modules/mod_wsgi.so Then It failed to start the server: httpd.exe: Syntax

Re: [Tutor] apache2.2 - django deployment

2010-02-09 Thread Glen Zangirolami
Joson, Everything looks good but I think the *module name is incorrect.* Change: LoadModule *python_module *modules/mod_wsgi.so To: LoadModule *wsgi_module *modules/mod_wsgi.so Glen On Tue, Feb 9, 2010 at 2:27 PM, Joson zhuchu...@gmail.com wrote: Hi all, I wanna deploy a django program on

Re: [Tutor] apache2.2 - django deployment

2010-02-09 Thread Glen Zangirolami
Joson, Everything looks good but I think the *module name is incorrect.* Change: LoadModule *python_module *modules/mod_wsgi.so To: LoadModule *wsgi_module *modules/mod_wsgi.so Glen On Tue, Feb 9, 2010 at 2:27 PM, Joson zhuchu...@gmail.com wrote: Hi all, I wanna deploy a django program on

[Tutor] Exiting a Tkinter Program-- An Anomaly or two

2010-02-09 Thread Wayne Watson
I'm looking a 1800+ line someone else wrote. It uses one large dialog for menus, and has a large area for images. A few menus open small dialogs, for example, to enter a file name. The File menu has an exit choice. The only other exit is the x in the upper right corner of the large dialog. I'm

[Tutor] NameError: global name 'celsius' is not defined (actually, solved)

2010-02-09 Thread David
Hi guys, I just wrote this message, but after restarting ipython all worked fine. How is it to be explained that I first had a namespace error which, after a restart (and not merely a new run Sande_celsius-main.py), went away? I mean, surely the namespace should not be impacted by ipython at

Re: [Tutor] NameError: global name 'celsius' is not defined (actually, solved)

2010-02-09 Thread wesley chun
I just wrote this message, but after restarting ipython all worked fine. How is it to be explained that I first had a namespace error which, after a restart (and not merely a new run Sande_celsius-main.py), went away? I mean, surely the namespace should not be impacted by ipython at all!?

Re: [Tutor] NameError: global name 'celsius' is not defined (actually, solved)

2010-02-09 Thread David
Hello Wesley, thanks for your reply. I was surprised about the limited information too. Sadly (?), I can't reproduce the error any more... David On 10/02/10 11:13, wesley chun wrote: I just wrote this message, but after restarting ipython all worked fine. How is it to be explained that I

[Tutor] how to clear contents of a file

2010-02-09 Thread sudhir prasad
hi, how to clear contents of a file with out actually deleting it, basically wat im trying to do is copy a source file into a common file ,run the common file,after that i need to copy another source file into the common file,i ant to clear the contents of the common file before copying

Re: [Tutor] how to clear contents of a file

2010-02-09 Thread Christian Witts
sudhir prasad wrote: hi, how to clear contents of a file with out actually deleting it, basically wat im trying to do is copy a source file into a common file ,run the common file,after that i need to copy another source file into the common file,i ant to clear the contents of the common