Re: Reverse function python? How to use?

2006-10-30 Thread Kay Schluehr
frankie_85 wrote: > Ok I'm really lost (I'm new to python) how to use the reverse function. > > > I made a little program which basically the a, b, c, d, e which I have > listed below and basically I want it th result to be printed reverse so > instead doing "print e, d, c, b, a", I'd like to use t

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Sachin Punjabi
On Oct 30, 12:42 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > Hi, > > > I wanted to read a file encoded in utf-8 and and using the following > > syntax in my source which throws me an error specifying Lookuperror : > > unknown encoding : utf-8. Also I am working on Pyth

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Fredrik Lundh
Sachin Punjabi wrote: > The OS is Windows XP then your installation is seriously broken. where did you get the installation kit? have you removed stuff from the Lib directory ? -- http://mail.python.org/mailman/listinfo/python-list

wxPython - which is the better sizer to use with notebook

2006-10-30 Thread Chris Brat
Hi, What sizers do people use to - contain the notebook control in a Frame and, - contain the contents of a single page of the notebook. At the moment Im using a GridBagSizer for both but this seems to be overkill. Is a BoxSizer a better option? Thanks Chris -- http://mail.python.org/mailman/l

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Sachin Punjabi
On Oct 30, 1:29 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > The OS is Windows XPthen your installation is seriously broken. where did > > you get the > installation kit? have you removed stuff from the Lib directory ? > > It was already installed on my PC and I h

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Leo Kislov
Sachin Punjabi wrote: > On Oct 30, 1:29 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > Sachin Punjabi wrote: > > > The OS is Windows XPthen your installation is seriously broken. where > > > did you get the > > installation kit? have you removed stuff from the Lib directory ? > > > > > > It

Re: question about True values

2006-10-30 Thread Antoon Pardon
On 2006-10-29, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 29 Oct 2006 00:31:23 -0700, Carl Banks wrote: > > That's why (for example) Python allows + to operate on lists, or strings, > or floats That was IMO a mistake. There are types for which concatenation as well as addition are meanin

Re: Is there a way to get utf-8 out of a Unicode string?

2006-10-30 Thread thebjorn
Fredrik Lundh wrote: > thebjorn wrote: > > > I've got a database (ms sqlserver) that's (way) out of my control, > > where someone has stored utf-8 encoded Unicode data in regular varchar > > fields, so that e.g. the string 'Blåbærsyltetøy' is in the database > > as 'Bl\xc3\xa5b\xc3\xa6rsyltet\xc3\x

Re: lossless transformation of jpeg images

2006-10-30 Thread Daniel Nogradi
> > > Last time I checked PIL was not able to apply > > > lossless transformations to jpeg images so > > > I've created Python bindings (or is it a > > > wrapper? I never knew the difference :)) for > > > the jpegtran utility of the Independent Jpeg > > > Group. > > > Why not use Tkinter for jpeg ?

Re: Is there a way to get utf-8 out of a Unicode string?

2006-10-30 Thread thebjorn
Gerrit Holl wrote: > Hei, > > On 2006-10-30 08:25:41 +0100, thebjorn wrote: > > def unfk(s): > > return eval(repr(s)[1:]).decode('utf-8') > > ... > > Is there a less hack'ish way to do this? > > Slightly lack hackish: > > return ''.join(chr(ord(c)) for c in s) Much less hackish :-) -- bjo

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Sachin Punjabi
On Oct 30, 1:54 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > On Oct 30, 1:29 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > Sachin Punjabi wrote: > > > > The OS is Windows XPthen your installation is seriously broken. where > > > > did you get the > > > installati

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Leo Kislov
Sachin Punjabi wrote: > I installed it again but it makes no difference. It still throws me > error for LookUp Error: unknown encoding : utf-8. Most likely you're not using the new python, you're still running old one. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Sachin Punjabi
On Oct 30, 12:47 pm, "thebjorn" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > I wanted to read a file encoded in utf-8 and and using the following > > syntax in my source which throws me an error specifying Lookuperror : > > unknown encoding : utf-8. Also I am working on Python version 2

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Sachin Punjabi
On Oct 30, 2:27 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > I installed it again but it makes no difference. It still throws me > > error for LookUp Error: unknown encoding : utf-8.Most likely you're not > > using the new python, you're still running old > one. > >

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Fredrik Lundh
Sachin Punjabi wrote: > I installed the newer version on D drive and it was previously > installed on C drive. Also the command which bjorn asked me to execute > on command line worked very much fine. what happens if you *type* in the problematic statements at the command line, e.g. >>> import

codecs - where are those on windows?

2006-10-30 Thread GHUM
I stumbled apon a paragraph in python-dev about "reducing the size of Python" for an embedded device: """ In my experience, the biggest gain can be obtained by dropping the rarely-used CJK codecs (for Asian languages). That should sum up to almost 800K (uncompressed), IIRC. """ So, my question is

Re: Optional Parameter Requirements

2006-10-30 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > If I'm building a function to accept optional parameters, do I need to > allow for the capture of both the positional arguments as well as the > keyword arguments? No. > If it doesn't make sense to allow keyword arguments, > can I just write: > > def myfunc(a, b, *tup)

Re: Import if condition is correct

2006-10-30 Thread Bruno Desthuilliers
MindClass wrote: > Is possible import a library according to a condition? > > if Foo = True: > import bar > Did you even try ? Would have been faster than posting here... -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'

slice's indices() method

2006-10-30 Thread smichr
It seems to me that the indices() method for slices is could be improved. Right now it gives back concrete indices for a range of length n. That is, it does not return any None values. Using an example from clpy about this the indices for a 'None, None, -2' slice for a range of length 10 are given

Re: stripping parts of elements in a list

2006-10-30 Thread Bruno Desthuilliers
CSUIDL PROGRAMMEr wrote: > folks, > I am new to python. > > I have a list made of elements > > ['amjad\n', 'kiki\n', 'jijiji\n'] > I am trying to get rid of '\n' after each name. > to get list as > ['amjad','kiki','jijiji'] > > But list does not have a strip function as string does have. Wha

Re: Where do nested functions live?

2006-10-30 Thread Rob Williscroft
Frederic Rentsch wrote in news:mailman.1428.1162113628.11739.python- [EMAIL PROTECTED] in comp.lang.python: >def increment_time (interval_ms): > outer weeks, days, hours, minutes, seconds, mseconds # 'outer' > akin to 'global' > (...) > mseconds = new_ms - s * 1000

Python 123 introduction

2006-10-30 Thread Jeremy Sanders
Here is a brief simple introduction to Python I wrote for a computing course for graduate astronomers. It assumes some programming experience. Although it is not a complete guide, I believe this could be a useful document for other groups to learn Python, so I'm making it available for others to do

Re: slice's indices() method

2006-10-30 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Is there any reason not to change the behavior of the indices() method > so it gives indices that can be used in range (to give indices > corresponding to elements that would be extracted by a given slice) > *and* used as arguments for slices so that the slice with the n

dict problem

2006-10-30 Thread Alistair King
Ben Finney wrote: > Alistair King <[EMAIL PROTECTED]> writes: > > >> Ben Finney wrote: >> >>> Even better, work on a minimal program to do nothing but reproduce >>> the unexpected behaviour. If you get to such a program and still >>> don't understand, then post it here so others can run it

Easy PIL Question?

2006-10-30 Thread [EMAIL PROTECTED]
I want to do something very simple: I want to read a palette image (256 color PNG or BMP for instance), and then just to output the image data as numbers (palette indexes, I guess). Makes sense? How do I do that? /David -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy PIL Question?

2006-10-30 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I want to do something very simple: > > I want to read a palette image (256 color PNG or BMP for instance), and > then just to output the image data as numbers (palette indexes, I > guess). it's explained in the documentation, of course: http://effbot.org/imaging

Re: Very simple request about argument setting.

2006-10-30 Thread Hieu Hoang
Hi, The shuf() function returns two values: x and foo. The command >>> x,foo,bar=shuf(1,2,3,4,5,6,7,8) becomes >>> x,foo,bar=x,foo So, this command assigns 2 values (x and foo) to 3 variables (x, foo and bar), which raises that exception. I'm not sure why python says "need more than 2 values t

Re: dict problem

2006-10-30 Thread Fredrik Lundh
Alistair King wrote: > Is there any other way of removing double and single quotes from a > number, as a string, to give the float value again? help(str) describes what you can do with a string (an object of type 'str', that is). among the methods listed, you'll find: > | strip(...) > |

Re: wxPython for web development?

2006-10-30 Thread Steve Holden
walterbyrd wrote: > I assume that wxWidgets can not be used if all you have is mod-python? > Correct. wxPython assumes access to some sort of screen-based interface, with direct keyboard and mouse input. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Sachin Punjabi
On Oct 30, 2:27 pm, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > Sachin Punjabi wrote: > > I installed it again but it makes no difference. It still throws me > > error for LookUp Error: unknown encoding : utf-8.Most likely you're not > > using the new python, you're still running old > one. > >

Re: [wxPython] wxFrame don't have Bind attribute ??

2006-10-30 Thread Steve Holden
Jia Lu wrote: > Hi all > I am using wxPy 2.6.3.2-2, But when run an application with self.Bind > , I got an error that there is no Bind. > > How can I fix it. thanx > Perhaps you could show us the code that's failing, with the traceback - even better, use the knowledge you have already gained

Re: Very simple request about argument setting.

2006-10-30 Thread Fredrik Lundh
Hieu Hoang wrote: > So, this command assigns 2 values (x and foo) to 3 variables (x, foo > and bar), which raises that exception. I'm not sure why python says > "need more than 2 values to unpack" not "need 3 values" though. probably because if you look at the call site x,foo,bar=shuf(1,2

ANN: SPE 0.8.3.c Python IDE editor

2006-10-30 Thread SPE - Stani's Python Editor
This is a maintenance release (mostly bug fixing) to prove that SPE is alive and well! In case you are using wxPython2.7 you'll need to upgrade to this release. Submitted patches will be reviewed and included if approved for next release. Thanks for all your patient support and continuing donations

Re: wxFrame don't have Bind attribute ??

2006-10-30 Thread SPE - Stani's Python Editor
Jia Lu schreef: > Hi all > I am using wxPy 2.6.3.2-2, But when run an application with self.Bind > , I got an error that there is no Bind. > > How can I fix it. thanx You can not bind an event to a wx application. You must bind an event to a wx frame or control. You'll get more and better suppo

Re: wxPython - which is the better sizer to use with notebook

2006-10-30 Thread SPE - Stani's Python Editor
Chris Brat schreef: > Hi, > > What sizers do people use to > - contain the notebook control in a Frame and, > - contain the contents of a single page of the notebook. > > At the moment Im using a GridBagSizer for both but this seems to be > overkill. > Is a BoxSizer a better option? Yes, use box

Re: wxFrame don't have Bind attribute ??

2006-10-30 Thread Jia Lu
Steve Holden のメッセージ: > Perhaps you could show us the code that's failing, the code is : #!/usr/bin/python -tt __author__ = "Jia Lu <[EMAIL PROTECTED]>" __verstion__ = "1.0.0" import wx class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, "MyFrame", size=(300,3

Re: wxFrame don't have Bind attribute ??

2006-10-30 Thread Frank Millman
Jia Lu wrote: > Steve Holden のメッセージ: > > Perhaps you could show us the code that's failing, > > the code is : > > > #!/usr/bin/python -tt > > __author__ = "Jia Lu <[EMAIL PROTECTED]>" > __verstion__ = "1.0.0" > > import wx > > class MyFrame(wx.Frame): > def __init__(self): > wx.Frame.__init

ZODB: single database, multiple connections

2006-10-30 Thread Petra Chong
Hello all I am using Python 2.3 and ZODB (without the rest of Zope) with the following pattern: * One process which writes stuff to a ZODB instance (call it test.db) * Another process which reads stuff from the above ZODB instance test.db What I find is that when the first process writes, the se

Re: Easy PIL Question?

2006-10-30 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > > it's explained in the documentation, of course: > > http://effbot.org/imagingbook/image.htm#Image.getdata > But as I read it, this gives me pixel values, i.e. colors. I want palette indexes instead (which is what is really stored in a palette image). I guess I can mak

MemoryError

2006-10-30 Thread Bugra Cakir
Hi,I have found a "MemoryError" exception in my program. How can i output Python interpreterlog or how can i find the root cause of this "MemoryError" exception ? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: MemoryError

2006-10-30 Thread Fredrik Lundh
Bugra Cakir wrote: > I have found a "MemoryError" exception in my program. How can i output > Python interpreter log or how can i find the root cause of this > "MemoryError" exception ? this means that you've run out of memory; the ordinary traceback print-out should tell you where. http

Re: ZODB: single database, multiple connections

2006-10-30 Thread Tim Peters
[Petra Chong] > I am using Python 2.3 and ZODB (without the rest of Zope) with the > following pattern: > > * One process which writes stuff to a ZODB instance (call it test.db) > * Another process which reads stuff from the above ZODB instance > test.db > > What I find is that when the first proce

Re: what are XLRDError and CompDocError?

2006-10-30 Thread John Machin
kath wrote: > Hi, > i am facing some problems with opening an excel file. I am using XLRD > module. > I am getting > > XLRDError: Can't find workbook in OLE2 compound document > > and > > CompDocError: Not a whole number of sectors > > exceptions in seperate try on different files. > > 1.Does any

Re: wxFrame don't have Bind attribute ??

2006-10-30 Thread Jia Lu
Frank Millman のメッセージ: > This works perfectly for me, using wxPython 2.6.3.2, on both Linux and > Windows. > > What platform are you using? Yes this works OK for me too on my FedoraCore 5, but cannot work on my FedoraCore 6... -- http://mail.python.org/mailman/listinfo/python-list

Re: dict problem

2006-10-30 Thread Alistair King
Fredrik Lundh wrote: > Alistair King wrote: > > >> Is there any other way of removing double and single quotes from a >> number, as a string, to give the float value again? >> > > help(str) describes what you can do with a string (an object of type > 'str', that is). among the methods lis

CHM help file for Python 2.5

2006-10-30 Thread [EMAIL PROTECTED]
Hello, For Python 2.4, documentation was available in .chm format. For new Python 2.5, I am missing this format (download page: http://docs.python.org/download.html). Can anyone point me to new location of this version of manual, or tell me why this format is no longer supported ... ? thanks --

Re: wxFrame don't have Bind attribute ??

2006-10-30 Thread Frank Millman
Jia Lu wrote: > Frank Millman のメッセージ: > > This works perfectly for me, using wxPython 2.6.3.2, on both Linux and > > Windows. > > > > What platform are you using? > Yes this works OK for me too on my FedoraCore 5, but cannot work on my > FedoraCore 6... Then it is probably an installation problem

Re: CHM help file for Python 2.5

2006-10-30 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > For Python 2.4, documentation was available in .chm format. For new > Python 2.5, > I am missing this format (download page: > http://docs.python.org/download.html). > Can anyone point me to new location of this version of manual, > or tell me why this format is no longe

Re: dict problem

2006-10-30 Thread Peter Otten
Alistair King wrote: > the code works great now. I know these things are quite simple to learn > from books etc.. but i would be lost without this mailinglist, from lack > of time. Hopefully soon i can give something more complicated. > I ended up doing the dictionary formatting properly and the n

Re: ZODB: single database, multiple connections

2006-10-30 Thread Petra Chong
> > If I have a Python shell open and run the above two lines, if I run the > > write process repeatedly, the above "data" object never contains any of > > the newly added items. To pick them up I have to totally recreate the > > "db" object. > > You say that like it's hard to do ;-) > It isn't,

Re: dict problem

2006-10-30 Thread Alistair King
Peter Otten wrote: > Alistair King wrote: > > >> the code works great now. I know these things are quite simple to learn >> from books etc.. but i would be lost without this mailinglist, from lack >> of time. Hopefully soon i can give something more complicated. >> I ended up doing the dictionar

Re: ANN: SPE 0.8.3.c Python IDE editor

2006-10-30 Thread Bernard
thanks Stani! SPE - Stani's Python Editor wrote: > This is a maintenance release (mostly bug fixing) to prove that SPE is > alive and well! In case you are using wxPython2.7 you'll need to > upgrade to this release. Submitted patches will be reviewed and > included if approved for next release. Th

Re: What's the best IDE?

2006-10-30 Thread [EMAIL PROTECTED]
This is the answer Linux --- BOA constructor Eric (the best for python I think it has cool subversion support better than emacs for non f4cmd67-b jockies emacs sucks anyway you look at it and lisp is a terrible terrible bad joke unless you are gondi) oh and some other t

IE7 skulduggery?

2006-10-30 Thread BartlebyScrivener
Hello everyone: I use Firefox, but perhaps unwisely accepted the XP update to IE7 when it came in. When I check under folder options, my htm and html files are still associated with FireFox. However, now when I attempt to use my nice site launcher that I wrote in Python (which has worked fine for

import in threads: crashes & strange exceptions on dual core machines

2006-10-30 Thread robert
I get python crashes and (in better cases) strange Python exceptions when (in most cases) importing and using cookielib lazy on demand in a thread. It is mainly with cookielib, but remember the problem also with other imports (e.g. urllib2 etc.). And again very often in all these cases where I

How can I import a script with an arbitrary name ?

2006-10-30 Thread leonel . gayard
Hi all, I have a script responsible for loading and executing scripts on a daily basis. Something like this: import time t = time.gmtime() filename = t[0] + '-' + t[1] + '-' + t[2] + '.py' import filename So, I have a module with an arbitrary file name and I want to load it, and later access its

Calling GNU/make from a Python Script

2006-10-30 Thread Efrat Regev
Hello, I need to call GNU/make from within a Python script. This raised some problems: 1. The script is not in the directory of the makefile, and changing the locations of either is not an option. Consequently, the makefile fails, since it can't find the targets/dependencies. 2. After sea

Re: How can I import a script with an arbitrary name ?

2006-10-30 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi all, > > I have a script responsible for loading and executing scripts on a > daily basis. Something like this: > > import time > t = time.gmtime() > filename = t[0] + '-' + t[1] + '-' + t[2] + '.py' > import filename > > So, I have a

Re: Calling GNU/make from a Python Script

2006-10-30 Thread Rob Williscroft
Efrat Regev wrote in news:[EMAIL PROTECTED] in comp.lang.python: >Hello, > >I need to call GNU/make from within a Python script. This raised some > problems: > 1. The script is not in the directory of the makefile, and changing the > locations of either is not an option. Consequently, t

Compile Python With SSL On Solaris 10

2006-10-30 Thread judasi
Hi, I am trying to compile py2.4.3/2.5 on a Solaris 10x86 machine, but cannot get it to build an SSL enabled version. I have added the relevant sfw directories into the path/crle, with no success. I've even explicitly added ssl via the --with-libs directive, yet an import _ssl still fails. Has

Backup Mailman?

2006-10-30 Thread Karl Groves
Does anyone out there know of a utility that will allow you to backup Mailman (including the subscribers and all messages)? TIA -- Karl Groves www.karlcore.com -- http://mail.python.org/mailman/listinfo/python-list

Re: importing class

2006-10-30 Thread gmarkowsky
Thanks for your help. Actually my idea was that command1 and command2 would be defined within the program, not the module, as I would have different choices in different programs. Should I pass them in as a parameter too? Greg Steve Holden wrote: > [EMAIL PROTECTED] wrote: > > Thanks, I got that

Re: Observation on "Core Python Programming"

2006-10-30 Thread John Salerno
John Coleman wrote: > Greetings, >My copy of the second edition of Chun's "Core Python Programming" > just arrived from Amazon on Friday. Who would you say the book is aimed at? Advanced programmers? I thought about getting it, but I'm not sure if it will be either 1) too much repetition of

Re: Calling GNU/make from a Python Script

2006-10-30 Thread Fredrik Lundh
Efrat Regev wrote: > 1. The script is not in the directory of the makefile, and changing the > locations of either is not an option. Consequently, the makefile fails, > since it can't find the targets/dependencies. build_dir = "path/to/makefile" cwd = os.getcwd() # get current directory try:

Re: wxPython changed ??

2006-10-30 Thread John Salerno
Jia Lu wrote: > Hi all. > I'm using wxPython 2.6.3.2-2 on FC 6. > I wrote a demo used 'self.Bind(xx)' but I got an error says: >" MyFrame instance has no attribute 'Bind' " > > I did that when I used FC 5 and it worked. > > Is new wxPy changed about the Bind method?? > > thanx > Pl

Re: wxPython - which is the better sizer to use with notebook

2006-10-30 Thread John Salerno
SPE - Stani's Python Editor wrote: > Chris Brat schreef: > >> Hi, >> >> What sizers do people use to >> - contain the notebook control in a Frame and, >> - contain the contents of a single page of the notebook. >> >> At the moment Im using a GridBagSizer for both but this seems to be >> overkill.

Re: How can I import a script with an arbitrary name ?

2006-10-30 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I have a script responsible for loading and executing scripts on a > daily basis. Something like this: > > import time > t = time.gmtime() > filename = t[0] + '-' + t[1] + '-' + t[2] + '.py' > import filename > > So, I have a module with an arbitrary file name and I wa

Re: codecs - where are those on windows?

2006-10-30 Thread Paul Watson
GHUM wrote: > I stumbled apon a paragraph in python-dev about "reducing the size of > Python" for an embedded device: > > """ > In my experience, the biggest gain can be obtained by dropping the > rarely-used > CJK codecs (for Asian languages). That should sum up to almost 800K > (uncompressed), I

Re: codecs - where are those on windows?

2006-10-30 Thread Fredrik Lundh
Paul Watson wrote: >> So, my question is: on Windows. where are those CJK codecs? Are they by >> any chance included in the 1.867.776 bytes of python24.dll ? > > If your installation directory is C:\Python25, then look in > > C:\Python25\lib\encodings that's only the glue code. the actual data

Re: Calling GNU/make from a Python Script

2006-10-30 Thread skip
Fredrik> build_dir = "path/to/makefile" Fredrik> cwd = os.getcwd() # get current directory Fredrik> try: Fredrik> os.chdir(build_dir) Fredrik> os.system("make") Fredrik> finally: Fredrik> os.chdir(cwd) Or even: os.system("make -C %s" % build_dir)

Re: Observation on "Core Python Programming"

2006-10-30 Thread John Coleman
John Salerno wrote: > John Coleman wrote: > > Greetings, > >My copy of the second edition of Chun's "Core Python Programming" > > just arrived from Amazon on Friday. > > Who would you say the book is aimed at? Advanced programmers? I thought > about getting it, but I'm not sure if it will be e

Re: Observation on "Core Python Programming"

2006-10-30 Thread John Coleman
John Coleman wrote: > John Salerno wrote: > > John Coleman wrote: > > > Greetings, > > >My copy of the second edition of Chun's "Core Python Programming" > > > just arrived from Amazon on Friday. > > > > Who would you say the book is aimed at? Advanced programmers? I thought > > about getting

Re: IE7 skulduggery?

2006-10-30 Thread BartlebyScrivener
Found fix for this at Mozilla: http://kb.mozillazine.org/Default_browser Apparently, even though it LOOKS and ACTS like Firefox is still your default browser after an IE7 upgrade, it's not. To fix, you must run: firefox.exe -silent -nosplash -setDefaultBrowser Which also fixes the webbrowser.

Re: Observation on "Core Python Programming"

2006-10-30 Thread John Salerno
John Coleman wrote: > John Coleman wrote: >> John Salerno wrote: >>> John Coleman wrote: Greetings, My copy of the second edition of Chun's "Core Python Programming" just arrived from Amazon on Friday. >>> Who would you say the book is aimed at? Advanced programmers? I thought >>>

checking if a sqlite connection and/or cursor is still open?

2006-10-30 Thread John Salerno
Is there a way to check if a SQLite connection and cursor object are still open? I took a look at the docs and the DB API but didn't see anything like this. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

create global variables?

2006-10-30 Thread Alistair King
Hi, is there a simple way of creating global variables within a function? ive tried simply adding the variables in: def function(atom, Xaa, Xab): Xaa = onefunction(atom) Xab = anotherfunction(atom) if i can give something like: function('C')#where atom = 'C' but not necessarly incl

Re: IE7 skulduggery?

2006-10-30 Thread Alistair King
BartlebyScrivener wrote: > Found fix for this at Mozilla: > > http://kb.mozillazine.org/Default_browser > > Apparently, even though it LOOKS and ACTS like Firefox is still your > default browser after an IE7 upgrade, it's not. > > To fix, you must run: > > firefox.exe -silent -nosplash -setDefaultB

Re: create global variables?

2006-10-30 Thread Gary Herron
Alistair King wrote: > Hi, > > is there a simple way of creating global variables within a function? > > Use the "global" statement within a function to bind a variable to a global. See http://docs.python.org/ref/global.html for details. >>> def x(): ... global g ... g = 12

Re: create global variables?

2006-10-30 Thread robert
Alistair King wrote: > Hi, > > is there a simple way of creating global variables within a function? > #module global: def f(atom): global a a=1 globals()[atom+'var']=2 def f(): a=b=1 globals().update(locals()) _global=sys.modules[__name__] def f(atom): _global.a = 1

Re: create global variables?

2006-10-30 Thread Wojciech Muła
Alistair King wrote: > is there a simple way of creating global variables within a function? def foo(name): globals()[name] = "xxx" globals()[name + 'aa'] = "yyy" globals()[name + 'ab'] = "zzz" -- http://mail.python.org/mailman/listinfo/python-list

Re: create global variables?

2006-10-30 Thread Alistair King
Gary Herron wrote: > Alistair King wrote: > >> Hi, >> >> is there a simple way of creating global variables within a function? >> >> >> > Use the "global" statement within a function to bind a variable to a > global. > > See http://docs.python.org/ref/global.html for details. > > > >

How to convert " " in a string to blank space?

2006-10-30 Thread 一首诗
Is there any simple way to solve this problem? -- http://mail.python.org/mailman/listinfo/python-list

Re: enumerate improvement proposal

2006-10-30 Thread Anders J. Munch
Ben Finney wrote: > > >>> def obstinate_economist_enumerate(items): > ... enum_iter = iter((i+1, x) for (i, x) in enumerate(items)) > ... return enum_iter iter is redundant here. def natural_enumerate_improvement(items, start=0): return ((i+start, x) for (i, x) in enumer

Re: How to convert " " in a string to blank space?

2006-10-30 Thread martdi
一首诗 wrote: > Is there any simple way to solve this problem? >>> myString = " " >>> myString = myString.replace(" ", "") -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert " " in a string to blank space?

2006-10-30 Thread [EMAIL PROTECTED]
Is this what you want? py> s = 'This string contains   two times   - end' py> print s.replace(' ', ' '*6) This string containstwo times- end see http://docs.python.org/lib/string-methods.html On Oct 30, 6:26 pm, "一首诗" <[EMAIL PROTECTED]> wrote: > Is there any simple way to solve

Re: How to convert " " in a string to blank space?

2006-10-30 Thread Gary Herron
一首诗 wrote: > Is there any simple way to solve this problem? > > Yes, strings have a replace method: >>> s = "abc def" >>> s.replace(' ',' ') 'abc def' Also various modules that are meant to deal with web and xml and such have functions to do such operations. Gary Herron -- http://mail.py

Re: How can I import a script with an arbitrary name ?

2006-10-30 Thread [EMAIL PROTECTED]
I had to do something like this a while back for a modular IRC bot that I wrote. __import__() will do the trick, however to avoid getting a cache of the module I recomend doing something like... mod = reload( __import__("%s-%s-%s" % ( t[0], t[1], t[2] ) ) ) [EMAIL PROTECTED] wrote: > Hi all, > >

Re: How to convert " " in a string to blank space?

2006-10-30 Thread 一首诗
Oh, I didn't make myself clear. What I mean is how to convert a piece of html to plain text bu keep as much format as possible. Such as convert " " to blank space and convert to "\r\n" Gary Herron wrote: > 一首诗 wrote: > > Is there any simple way to solve this problem? > > > > > Yes, strings have

Re: Python 123 introduction

2006-10-30 Thread [EMAIL PROTECTED]
This is great! A excellent tutorial for somone who has prior experience in programming and is starting out in python. My friend keeps wanting me to teach him python, I think this would be the perfect link for him. Thanks. Jeremy Sanders wrote: > Here is a brief simple introduction to Python I wro

Re: create global variables?

2006-10-30 Thread J. Clifford Dyer
Alistair King wrote: > Hi, > > is there a simple way of creating global variables within a function? > > ive tried simply adding the variables in: > > def function(atom, Xaa, Xab): > Xaa = onefunction(atom) > Xab = anotherfunction(atom) > > if i can give something like: > > function('C

Re: Observation on "Core Python Programming"

2006-10-30 Thread wesley chun
(warning: LONG reply) thanks to those above for the kind remarks. tackling comments and questions, not quite in chronological order. :-) > Who would you say the book is aimed at? Advanced programmers? this book is targeted towards technical professionals already literate in another high-level

Re: Python 123 introduction

2006-10-30 Thread Jeremy Sanders
[EMAIL PROTECTED] wrote: > This is great! A excellent tutorial for somone who has prior experience > in programming and is starting out in python. My friend keeps wanting > me to teach him python, I think this would be the perfect link for him. I'm glad you think it is useful. It needs a bit of c

Re: How to convert " " in a string to blank space?

2006-10-30 Thread [EMAIL PROTECTED]
On Oct 30, 6:44 pm, "一首诗" <[EMAIL PROTECTED]> wrote: > Oh, I didn't make myself clear. > > What I mean is how to convert a piece of html to plain text bu keep as > much format as possible. > > Such as convert " " to blank space and convert to "\r\n" > Then you can explore the parser, http://doc

Re: How to convert " " in a string to blank space?

2006-10-30 Thread Fredrik Lundh
一首诗 wrote: > Is there any simple way to solve this problem?   corresponds to a non-breaking space, chr(160). if you're only dealing with this specific XML/HTML entity, you can do text = text.replace(" ", " ") or text = text.replace(" ", chr(160)) to handle arbitrary entities and c

Re: create global variables?

2006-10-30 Thread Fredrik Lundh
Wojciech Muła wrote: >> is there a simple way of creating global variables within a function? > > def foo(name): > globals()[name] = "xxx" > globals()[name + 'aa'] = "yyy" > globals()[name + 'ab'] = "zzz" that kind of coding is punishable by law in some jurisdictions. -- ht

Re: Calling GNU/make from a Python Script

2006-10-30 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > Fredrik> build_dir = "path/to/makefile" > > Fredrik> cwd = os.getcwd() # get current directory > Fredrik> try: > Fredrik> os.chdir(build_dir) > Fredrik> os.system("make") > Fredrik> finally: > Fredrik> os.chdir(cwd) > > Or even: > >

Re: Python 123 introduction

2006-10-30 Thread skip
dakman> This is great! A excellent tutorial for somone who has prior dakman> experience in programming and is starting out in python. My dakman> friend keeps wanting me to teach him python, I think this would dakman> be the perfect link for him. I'm not trying to minimize Jeremy's

Re: Calling GNU/make from a Python Script

2006-10-30 Thread skip
>> os.system("make -C %s" % build_dir) >> OP specified GNU make, so that works fine, but make sure you're not >> going to need to use it with another make before settling on that >> alternative. Frederik's works with more versions of make. Understood. That was the only reason I

Re: ANN: SPE 0.8.3.c Python IDE editor

2006-10-30 Thread Chris Seymour
Hi Stani, Not able to reach Berlios. The SourceForge page does not have the Windows installer. Any ideas when it will be available? Thanks. Chris Bernard wrote: > thanks Stani! > > SPE - Stani's Python Editor wrote: > > This is a maintenance release (mostly bug fixing) to prove that SPE is > >

scared about refrences...

2006-10-30 Thread SpreadTooThin
I'm really worried that python may is doing some things I wasn't expecting... but lets see... if I pass a list to a function def fn(myList): and in that function I modify an element in the list, then does the callers list get modied as well. def fn(list): list[1] = 0 myList = [1, 2, 3] print

  1   2   >