Re: help in converting perl re to python re

2006-03-03 Thread Joel Hedlund
Hi > the perl code finds a line that matches something like > "sometext<\tag1>" in the line and then assign $variable the value > of "sometext" No, but if you use a closing instead of <\tag1> it does. You had me scratching my head for a while there. :-) This should do it in python:

Re: newbie question

2006-03-03 Thread P Boy
Since you are a Windows user, I strongly recommend that you install activestate python instead of the one you download from python.org. The PythonWin from active state is much more user friendly. It's basically an IDE (integrated development environment), which includes interactive shell, editor, d

Re: Question

2006-03-03 Thread P Boy
You may want to read up on http://python.org/doc/faq/installed.html -- http://mail.python.org/mailman/listinfo/python-list

Importing Files

2006-03-03 Thread anushya beauty
Hi,    I am very sorry for confusing you with the file names. Now i want to say you one more thing and i change my ex filenames to the exact filenames. The below is  what i explained in my previous mail: **  My files are: 1. D:\TestDir\module\config.py 2. D:\TestDir\scripts\http

Re: string stripping issues

2006-03-03 Thread P Boy
This seems like a web page parsing question. Another approach can be as follows if you know the limiting token strings: a.split('')[1].split('\r\n')[0] -- http://mail.python.org/mailman/listinfo/python-list

Re: slicing the end of a string in a list

2006-03-03 Thread P Boy
One liners are cool. Personally however, I would not promote one liners in Python. Python code is meant to be read. Cryptic coding is in perl's world. Code below is intuitive and almost a three year old would understand. for line in open('C:\\switches.txt'): print line.rstrip() BTW, if t

Re: setattr question

2006-03-03 Thread bruno at modulix
bruno at modulix wrote: (snip) > Je ne vois pas très bien à quoi sert cette classe (à moins bien sûr > qu'il y ait d'autre code). Pour ce que je vois là, pourquoi ne pas > appeler directement les classes HtmlPage, HtmlElement et HtmlLiteral ? > oops, sorry, forgot to remove this before posting :(

Re: string stripping issues

2006-03-03 Thread Tim Williams (gmail)
On 3 Mar 2006 00:20:21 -0800, P Boy <[EMAIL PROTECTED]> wrote: This seems like a web page parsing question. Another approach can be asfollows if you know the limiting token strings:a.split('SIZE=2>')[1].split('\r\n')[0] As others have mentioned , you really need a an HTML parser.   But the fo

Re: slicing the end of a string in a list

2006-03-03 Thread Peter Otten
P Boy wrote: > BTW, if the file is huge, one may want to consider using > open('c:\\switches.txt', 'rb') instead. Why? -- http://mail.python.org/mailman/listinfo/python-list

Re: Question

2006-03-03 Thread Duncan Booth
Tom Leggio wrote: > Do I need this on my computer---Python---can I remove it without hurting > anything? Without further information it is hard to answer, you haven't even said what operating system you are running, let alone what programs you have installed. Your message headers imply you are

Re: setattr question

2006-03-03 Thread bruno at modulix
Gerard Flanagan wrote: > bruno at modulix wrote: > (snip french) > > I was trying to implement the factory pattern. > The recipe above uses 'apply' which is deprecated according to the > docs, and I suppose I was curious how to do the same sort of thing > without 'apply'. def fun(*args, **kwargs

Re: re-posting: web.py, incomplete

2006-03-03 Thread Magnus Lycka
_wolf wrote: > then the output is :: > > Hello, oops! > Hello, oops! > <20 lines omitted/> > Hello, oops! > Hel Are you running Python unbuffered? I.e. python -u -- http://mail.python.org/mailman/listinfo/python-list

Re: slicing the end of a string in a list

2006-03-03 Thread P Boy
I had some issues while ago trying to open a large binary file. Anyway, from file() man page: If mode is omitted, it defaults to 'r'. When opening a binary file, you should append 'b' to the mode value for improved portability. (It's useful even on systems which don't treat binary and text files

scipy

2006-03-03 Thread computer1
I want to install scipy 0.4.6 (windows)on my computer ,but i cannot download it from www.scipy.org. who can tell me another place to download it? -- http://mail.python.org/mailman/listinfo/python-list

Re: do design patterns still apply with Python?

2006-03-03 Thread bruno at modulix
ajones wrote: (snip) > I would suggest getting a good grasp on OOP before you get into design > patterns. When most people start with any new concept they tend to try > and see everything in terms of their new toy, so sticking to one or two > new concepts at a time will make things a little easie

Convert dictionary to HTTP POST

2006-03-03 Thread Laszlo Zsolt Nagy
Hello, How can I convert a dictionary into a HTTP POST string? I have an example below, but this is not working correctly for special characters. (" ' and others). In other words, if I use "Bessy's cat" instead of "Bessy" then the http server will parse that to "Bessy's cat" Probably the prob

Re: Write a GUI for a python script?

2006-03-03 Thread Matthias Huening
Glurt Wuntal (02.03.2006 15:56): > I am a newbie with Python. It's a great language, but I would like to be > able to present a simple gui menu for some of my scripts; something better > than using 'raw_input' prompts. > If you only need some dialogs, input and/or message boxes, you could start

Re: Write a GUI for a python script?

2006-03-03 Thread peter . mosley
Hi I, too, am a python newbie and have wrestled with GUI programming. I think I am winning, but its been a struggle. >From what I have gleaned, there are three and a half options. The half is easygui - see http://www.ferg.org/easygui - which allows you to place pop up dialogues in procedural co

Re: PEP 354: Enumerations in Python

2006-03-03 Thread Christos Georgiou
On 26 Feb 2006 22:30:28 -0800, rumours say that "Crutcher" <[EMAIL PROTECTED]> might have written: >This seems great, except why can't I compare strings? It seems too >useful when dealing with user input, or parsing messages or config >files. > Weekdays = enum('sun', 'mon', 'tue', 'wed', 'thu

Re: white space in expressions and argument lists

2006-03-03 Thread Sybren Stuvel
Scott David Daniels enlightened us with: > One reason is such code changes too much on code edits, which makes > code differences hard to read. Good point. I'll keep it in mind :) Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, bu

Re: white space in expressions and argument lists

2006-03-03 Thread Sybren Stuvel
rtilley enlightened us with: > I took it literally when I first read it b/c it made sense to me and > I did not notice the date. I don't think it will ever be _required_ > of all Python hackers, but I may be wrong. Well, part of it is a serious PEP. It being _required_ was the joke. Sybren -- Th

Re: PythonWin: any way to delete all objects without exiting and without doing it with "del"?

2006-03-03 Thread dananrg
Steven, does your technique fix my problem? Would that delete the objects I've created within a program if I suffix my code with it? -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Sybren Stuvel
Laszlo Zsolt Nagy enlightened us with: > How can I convert a dictionary into a HTTP POST string? I have an > example below, but this is not working correctly for special > characters. (" ' and others). URL-quote it. > In other words, if I use "Bessy's cat" instead of "Bessy" then the > http serv

How much does Python optimize?

2006-03-03 Thread Blackbird
Hello! I think for i in range(10): is more readable than a while loop with explicit incrementation of i. However, range(10) in the command interpreter obviously returns a list. Is this list optimized away in the code above, or is it actually constructed internally? (With, say, CPython in

Re: How much does Python optimize?

2006-03-03 Thread Felipe Almeida Lessa
Em Sex, 2006-03-03 às 10:26 +0100, Blackbird escreveu: > However, range(10) in the command interpreter obviously returns a list. Is > this list optimized away in the code above, or is it actually constructed > internally? (With, say, CPython in one of the recent versions.) It's constructed. That'

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Steve Holden
Laszlo Zsolt Nagy wrote: > Hello, > > How can I convert a dictionary into a HTTP POST string? > I have an example below, but this is not working correctly for special > characters. (" ' and others). In other words, if I use "Bessy's cat" > instead of "Bessy" then the http server will parse tha

Re: how to overload sqrt in a module?

2006-03-03 Thread david mugnai
On Thu, 02 Mar 2006 19:24:48 -0800, mforbes wrote: [snip] > I know, but the point is that I want to allow the user of the module to be > able to specify which sqrt function should be used depending on the type > of x. Importing math in the module would prevent the user from using f() > with c

Re: how do you move to a new line in your text editor?

2006-03-03 Thread Duncan Booth
John Salerno wrote: > But I read in the PEP that spaces are recommended over tabs. If this is > the case, it would involve pressing backspace 4 times (or 8, etc.) to > get back to column 1. In the editor which I use, pressing the tab key indents the current line under the previous one the firs

getting the reference count of an object ...

2006-03-03 Thread Wildemar Wildenburger
... how? I'm writing an app that holds a public data dictionary from which other objects obtain part of their __dict__ values so they all work on the same dataset (yes I'm fiendishly clever and a constructor of unreadable sentences (and code) ;)). My problem is that I haven't found an easy way

Re: how to overload sqrt in a module?

2006-03-03 Thread Steven D'Aprano
On Thu, 02 Mar 2006 22:35:51 -0800, Michael McNeil Forbes wrote: > What I was thinking was: is there some way to pass a parameter to the > module on import so that the module can then use the correct environment. > > If I could pass a dictionary to the module with all of the overloaded > functi

Re: do design patterns still apply with Python?

2006-03-03 Thread Paul Boddie
Paul Rubin wrote: > Roy Smith <[EMAIL PROTECTED]> writes: > > > Somewhat less often, something is easy in Java and difficult in > > > Python. > > Example? > > Sandboxed code is a real obvious one. I don't disagree that this is true in general, but is that actually covered in the design patterns bo

Re: slicing the end of a string in a list

2006-03-03 Thread Steven D'Aprano
On Fri, 03 Mar 2006 01:03:38 -0800, P Boy wrote: > I had some issues while ago trying to open a large binary file. The important term there is BINARY, not large. Many problems *reading* (not opening) binary files will go away if you use 'rb', regardless of whether they are small, medium or large.

Re: do design patterns still apply with Python?

2006-03-03 Thread Nick Craig-Wood
ajones <[EMAIL PROTECTED]> wrote: > I would suggest getting a good grasp on OOP before you get into design > patterns. When most people start with any new concept they tend to try > and see everything in terms of their new toy, so sticking to one or two > new concepts at a time will make things

Re: getting the reference count of an object ...

2006-03-03 Thread Just
In article <[EMAIL PROTECTED]>, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > ... how? > > I'm writing an app that holds a public data dictionary from which other > objects obtain part of their __dict__ values so they all work on the > same dataset (yes I'm fiendishly clever and a constru

Re: setattr question

2006-03-03 Thread Gerard Flanagan
bruno at modulix wrote: [...] > > I don't know this HtmlElement class, nor where it comes from. > 'to_string()' (or is it toString() ?) is javaish. The pythonic idiom for > this is implementing the __str__() method and calling str(obj) on the > obj (which will call obj.__str__()). Hence my (bad) gu

Re: help in converting perl re to python re

2006-03-03 Thread Sybren Stuvel
Joel Hedlund enlightened us with: > regexp = re.compile(r"<(tag1)>(.*)") I'd go for regexp = re.compile(r"<(tag1)>(.*?)") Otherwise this: line = "sometextothertext" match = regexp.search(line) will result in 'sometextothertext' Sybren -- The problem with the world is stupidity. Not saying t

relocate python compiled file

2006-03-03 Thread anushya beauty
Hi,     When i run the python file, the python compiled file is created. Is it possible to relocate the python compiled file to some other directory?. Is it possible to frequent update the relocated pyc file while running the py file?thanks and regards, abbi Yahoo! Mail Bring photos to

Re: when do two names cease to refer to the same string object?

2006-03-03 Thread Steven D'Aprano
On Thu, 02 Mar 2006 20:45:10 -0500, John Salerno wrote: > To test this out a wrote a little script as an exercise: > > for num in range(1, 10): > x = 'c' * num > y = 'c' * num > > if x is y: > print 'x and y are the same object with', num, 'characters' > el

encoding problem

2006-03-03 Thread Yves Glodt
Hi list, Playing with the great pysvn I get this problem: Traceback (most recent call last): File "D:\avn\mail.py", line 80, in ? mailbody += diff UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 10710: ordinal not in range(128) It seems the pysvn.client.diff fun

sockets, where can I find documentation?

2006-03-03 Thread John Pote
Hi all, I want to use python on a server to access incoming TCP port accesses. So I need to use the socket interface which is new to me. To quote the Py Library Reference "7.2 socket -- Low-level networking interface":- For an introduction to socket programming (in C), see the following papers:

Re: Printing a file

2006-03-03 Thread David Boddie
Fabian Steiner wrote: > David Boddie wrote: > > In Qt 4, the demos/textedit demo does this with a lot less code. > > > > Or are you think of something else? > > Thank you very much for this hint! Thanks to this example I was able to > print out my first pages :) That's good to hear. :-) > But so

Re: help in converting perl re to python re

2006-03-03 Thread Joel Hedlund
> I'd go for > regexp = re.compile(r"<(tag1)>(.*?)") Indeed. I second that. /Joel -- http://mail.python.org/mailman/listinfo/python-list

Re: how do you move to a new line in your text editor?

2006-03-03 Thread Eric Deveaud
John Salerno wrote: > This is a real small point, but I'd like to hear what others do in this > case. It's more an 'administrative' type question than Python code > question, but it still involves a bit of syntax. > > One thing I like to do is use tabs for my indentation, because this > ma

Re: encoding problem

2006-03-03 Thread Sebastjan Trepca
I think you are trying to concatenate a unicode string with regular one so when it tries to convert the regular string to unicode with ASCII(default one) encoding it fails. First find out which of these strings is regular and how it was encoded, then you can decode it like this(if regular string is

Re: re-posting: web.py, incomplete

2006-03-03 Thread _wolf
it does look like it, no? but i don't---at least i think i don't. in my httpd conf it says ``AddHandler cgi-script .py``, and at the top of my script, ``#!/usr/local/bin/python``. standard, no ``-u`` here. -- http://mail.python.org/mailman/listinfo/python-list

Re: sockets, where can I find documentation?

2006-03-03 Thread Mc Osten
On Fri, 03 Mar 2006 11:41:05 GMT, John Pote wrote: > Where can I get the various papers mentioned in the manual? And as I like > books sitting on the shelf can someone recommend a book on sockets. Unix Network Programming by Stevens -- USB Priests for only 10$ -- http://mail.python.org/mailma

Re: in need of some sorting help

2006-03-03 Thread Kent Johnson
ianaré wrote: >> you did make me understand a way to sort this thing finally: sort by > base path then by full path, which is how i came up with: > > files.sort(key=lambda x: x.lower()) > files.sort(key=lambda x: os.path.dirname(x)) > > well actually i am sorting first by full name, then by base

Re: Exception not raised - May be the end

2006-03-03 Thread Sion Arrowsmith
Michele Petrazzo <[EMAIL PROTECTED]> wrote: >some days ago I posted here and say that python "forgot" to raise an >exception, but my code was too long for make some tries possible. >But now I can reproduce the problem into another, little, project: > >www.unipex.it/vario/wxFrameSchedule.py >www.un

object's list index

2006-03-03 Thread William Meyer
hi, I need to get the index of an object in a list. I know that no two objects in the list are the same, but objects might evaluate as equal. for example list = [obj1, obj2, obj3, obj4, obj5] for object in list: objectIndex = list.index(object) print objectIndex prints 0, 1, 2, 3, 2

Re: Write a GUI for a python script?

2006-03-03 Thread Peter Decker
On 3 Mar 2006 01:16:23 -0800, [EMAIL PROTECTED] > I, too, am a python newbie and have wrestled with GUI programming. I > think I am winning, but its been a struggle. I started with wxPython and struggled with it for a long time. I was able to get the job done, but using it never seemed natural.

Re: how do you move to a new line in your text editor?

2006-03-03 Thread Mc Osten
On Thu, 02 Mar 2006 18:58:50 GMT, John Salerno wrote: > I use UltraEdit right now, and it is possible to convert spaces and tabs > back and forth, but it's just an extra step. I wouldn't definitely suggest UltraEdit to code Python. Probably you should try scite. I'm using TextMate (but it's M

Re: string stripping issues

2006-03-03 Thread Iain King
Ben Cartwright wrote: > Ben Cartwright wrote: > > orangeDinosaur wrote: > > > I am encountering a behavior I can think of reason for. Sometimes, > > > when I use the .strip module for strings, it takes away more than what > > > I've specified. For example: > > > > > > >>> a = 'Hughes. John\r

Re: Exception not raised - May be the end

2006-03-03 Thread Michele Petrazzo
Sion Arrowsmith wrote: > Michele Petrazzo <[EMAIL PROTECTED]> wrote: >> some days ago I posted here and say that python "forgot" to raise >> an exception, but my code was too long for make some tries >> possible. But now I can reproduce the problem into another, little, >> project: >> >> www.unip

Re: object's list index

2006-03-03 Thread Iain King
William Meyer wrote: > hi, > > I need to get the index of an object in a list. I know that no two objects > in the list are the same, but objects might evaluate as equal. for example > > list = [obj1, obj2, obj3, obj4, obj5] > for object in list: > objectIndex = list.index(object) > pr

Re: object's list index

2006-03-03 Thread Sebastjan Trepca
Um, what about: for oindex in xrange(len(list)): object = list[oindex] print oindex You can't create a generic function for this. Sebastjan On 3/3/06, William Meyer <[EMAIL PROTECTED]> wrote: > hi, > > I need to get the index of an object in a list. I know that no two objects > in the

Re: object's list index

2006-03-03 Thread Fredrik Lundh
William Meyer wrote: >I need to get the index of an object in a list. I know that no two objects > in the list are the same, but objects might evaluate as equal. for example > > list = [obj1, obj2, obj3, obj4, obj5] > for object in list: >objectIndex = list.index(object) >print objectI

Re: object's list index

2006-03-03 Thread William Meyer
Iain King gmail.com> writes: > what's wrong with: > > i = 0 > for object in list: > objectIndex = i > print objectIndex > i += 1 > > Iain > The issues with that is you might have a complex structure below the for object in list: with lots of continues or breaks and you don't want

Re: object's list index

2006-03-03 Thread William Meyer
Kent Johnson kentsjohnson.com> writes: > In either case enumerate() is your friend. To find an > item by identity: > > def index_by_id(lst, o): >for i, item in enumerate(lst): > if item is o: >return i >raise ValueError, "%s not in list" % o > > If you just want the index

Re: RPC client class?

2006-03-03 Thread Dick Watson
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > if the RPC you're talking about is Sun RPC, the whole concept is pretty > dated (the original RFCs are from the late eighties). Just because it's dated doesn't meant it isn't still something that occasionally needs don

Re: object's list index

2006-03-03 Thread Iain King
Iain King wrote: > William Meyer wrote: > > hi, > > > > I need to get the index of an object in a list. I know that no two > > objects > > in the list are the same, but objects might evaluate as equal. for example > > > > list = [obj1, obj2, obj3, obj4, obj5] > > for object in list: > > o

Re: sockets, where can I find documentation?

2006-03-03 Thread utabintarbo
For a good general book on networking with python, try Foundations of Python Network Programming by John Goerzen. http://www.amazon.com/gp/product/1590593715/qid=1141390241/sr=1-9/ref=sr_1_9/104-7194399-1227965?s=books&v=glance&n=283155 -- http://mail.python.org/mailman/listinfo/python-list

Re: object's list index

2006-03-03 Thread Felipe Almeida Lessa
Em Sex, 2006-03-03 às 12:48 +, William Meyer escreveu: > Kent Johnson kentsjohnson.com> writes: > > > In either case enumerate() is your friend. To find an > > item by identity: > > > > def index_by_id(lst, o): > >for i, item in enumerate(lst): > > if item is o: > >return i

Re: object's list index

2006-03-03 Thread Iain King
Iain King wrote: > Iain King wrote: > > William Meyer wrote: > > > hi, > > > > > > I need to get the index of an object in a list. I know that no two > > > objects > > > in the list are the same, but objects might evaluate as equal. for example > > > > > > list = [obj1, obj2, obj3, obj4, obj5

socket freezes

2006-03-03 Thread Luis P. Mendes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I've developed a program that uses a socket to receive information 24h a ~ day. The problem is that the socket seems to freeze. By that I mean the program stops getting information but doesn't raise any error. I tried to solve this by writing t

Re: object's list index

2006-03-03 Thread Kent Johnson
William Meyer wrote: > hi, > > I need to get the index of an object in a list. I know that no two objects > in the list are the same, but objects might evaluate as equal. for example > > list = [obj1, obj2, obj3, obj4, obj5] > for object in list: > objectIndex = list.index(object) > p

Re: sockets, where can I find documentation?

2006-03-03 Thread Rene Pijlman
John Pote: >I want to use python on a server to access incoming TCP port accesses. So I >need to use the socket interface which is new to me. You may also want to look at Twisted: http://twistedmatrix.com/trac/ >Where can I get the various papers mentioned in the manual? And as I like >books s

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Laszlo Zsolt Nagy
> > >See urllib.urlencode(). No idea why they don't include it in urllib2 as >well, but there you go. > > >>> from urllib import urlencode > >>> urlencode({'a':'& "Simple string"', 'b': '<>[EMAIL PROTECTED]&*()_+='}) >'a=%26+%22Simple+string%22&b=%3C%3E%21%40%23%24%25%5E%26%2A%28%29_%2B%3D' > >>>

Re: object's list index

2006-03-03 Thread Sybren Stuvel
Iain King enlightened us with: > i = 0 > for object in list: > objectIndex = i > print objectIndex > i += 1 Why not: for index, object in enumerate(list): print index Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity

Re: setattr question

2006-03-03 Thread bruno at modulix
Gerard Flanagan wrote: > bruno at modulix wrote: > [...] > >>I don't know this HtmlElement class, nor where it comes from. >>'to_string()' (or is it toString() ?) is javaish. The pythonic idiom for >>this is implementing the __str__() method and calling str(obj) on the >>obj (which will call obj._

Re: Module written in C does not repond to Ctrl-C interruption.

2006-03-03 Thread fraca7
Bo Peng a écrit : > Dear list, > > I have not done a thorough test, but it occurs to me that > > 1. python code can be interrupted by Ctrl-C. > 2. A C module, if I add a main() function and run independently, can be > interrupted by Ctrl-C. > 3. If I load the C module in python and run, the prog

Re: do design patterns still apply with Python?

2006-03-03 Thread msoulier
Personally, I find many of the design patterns apply but require modification. For example, the Factory pattern is mostly to work around the fact that it's difficult in Java and C++ to dynamically load classes. Not so in Python, especially with exec. A simple configuration file and an exec call ca

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Steve Holden
[copied to list] Laszlo Zsolt Nagy wrote: >> >> >> See urllib.urlencode(). No idea why they don't include it in urllib2 >> as well, but there you go. >> >> >>> from urllib import urlencode >> >>> urlencode({'a':'& "Simple string"', 'b': '<>[EMAIL PROTECTED]&*()_+='}) >> 'a=%26+%22Simple+string%22

Re: Does '#hash' mean anything in IDLE?

2006-03-03 Thread John Coleman
John Salerno wrote: > John Coleman wrote: > > John Coleman wrote: > >> Greetings, > >>I am currently trying to learn Python through the excellent > >> "Learning Python" book. > > me too! > > > It isn't just #hash, but also things like #dict, #int, #len at the > > start of a comment line which

How to get and set the content of system clip-board.

2006-03-03 Thread Peter Cai
Question 1 : How to set and get the content of my system clip-board? 2 : How to print the current line no in a python program? --      每一种结局都有可能感触动观众心底的某一颗眼泪。以死亡为结尾的故事和大团圆故事一样多,是因为人们最不能承受的反 倒是漫长而不可知的人生,让传奇湮灭,让真情淡去,让英雄苍老,让美人迟暮。他爱他,他死了,另一个人终身铭记。再没有了世俗压力,他与他的往昔相依相伴 在断臂山下,他与他的未来活在永恒的回忆里。   

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Sybren Stuvel
Laszlo Zsolt Nagy enlightened us with: > The values of some inputs are encoded using html entities. How can > I decode a string like "Bessy's cat" in "Bessy's cat"? This should help: http://docs.python.org/lib/module-htmlentitydefs.html Sybren -- The problem with the world is stupidity. Not sa

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Laszlo Zsolt Nagy
> Well I don't understand what's encoding the apostrophe as an encoded > entity anyway. That's only supposed to be done for HTML content, not > form content. You are right. I was wrong. The problem was not with quote. It was reading out the VALUE of an INPUT from HTML source. > How about an

Re: do design patterns still apply with Python?

2006-03-03 Thread Roy Smith
In article <[EMAIL PROTECTED]>, "msoulier" <[EMAIL PROTECTED]> wrote: > For example, the Factory pattern is mostly to work around the fact that > it's difficult in Java and C++ to dynamically load classes. You're over-specifying. Most of most design patterns is to work around the fact that it'

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Kent Johnson
Laszlo Zsolt Nagy wrote: > The values of some inputs are encoded using html entities. > How can I decode a string like "Bessy's cat" in "Bessy's cat"? http://groups.google.com/group/comp.lang.python/browse_frm/thread/819731a536a4c1a2/fce6c2f6c3d46e9c?q=htmlentitydefs&rnum=2#fce6c2f6c3d46e9c Kent

Re: how to write file with cp1250 encodings?

2006-03-03 Thread jean-michel bain-cornu
Hi, Grzegorz Smith wrote: > Hi all. I have got situation: i load data from database(MSSQL) wchich are > encoded cp1250 and I fill template with that data (Cheetah Template), after > all i want to save template to file on disk. I'm using > newfile = open("template.html",w") > newfile.write(str(temp

Re: socket freezes

2006-03-03 Thread Rene Pijlman
Luis P. Mendes: >I've developed a program that uses a socket to receive information 24h a >~ day. > >The problem is that the socket seems to freeze. By that I mean the >program stops getting information but doesn't raise any error. That's weird. There's probably a bug in your program. >I tried t

Re: Does '#hash' mean anything in IDLE?

2006-03-03 Thread Blackbird
John Coleman <[EMAIL PROTECTED]> skrev: > John Salerno wrote: >> John Coleman wrote: >>> John Coleman wrote: Greetings, I am currently trying to learn Python through the excellent "Learning Python" book. >> >> me too! >> >>> It isn't just #hash, but also things like #dict, #int,

Re: do design patterns still apply with Python?

2006-03-03 Thread Irmen de Jong
Roy Smith wrote: > >> For example, the Factory pattern is mostly to work around the fact that >> it's difficult in Java and C++ to dynamically load classes. > > You're over-specifying. Most of most design patterns is to work around the > fact that it's difficult in Java and C++ to do many thing

Re: how do you move to a new line in your text editor?

2006-03-03 Thread Mystilleef
On Linux you can try out Scribes. It has a function to convert tabs to spaces. Personally, I use tabs in all my projects. http://scribes.sf.net/snippets.htm http://scribes.sf.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert dictionary to HTTP POST

2006-03-03 Thread Fredrik Lundh
Laszlo Zsolt Nagy wrote: > The values of some inputs are encoded using html entities. > How can I decode a string like "Bessy's cat" in "Bessy's cat"? this snippet might help: http://effbot.org/zone/re-sub.htm#strip-html -- http://mail.python.org/mailman/listinfo/python-list

Re: Write a GUI for a python script?

2006-03-03 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, Matthias Huening <[EMAIL PROTECTED]> wrote: > Glurt Wuntal (02.03.2006 15:56): > > I am a newbie with Python. It's a great language, but I would like to be > > able to present a simple gui menu for some of my scripts; something better > > than using 'raw_input' pro

Re: socket freezes

2006-03-03 Thread Steve Holden
Luis P. Mendes wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi, > > I've developed a program that uses a socket to receive information 24h a > ~ day. > > The problem is that the socket seems to freeze. By that I mean the > program stops getting information but doesn't raise any

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-03 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > # Print new list > print recordList > > [872L, 'ACTIVE', , >>>00EA1428>, None, '1.0.0.0', None, None, None] Read the Python library manual chapter 2. Read all of it, it's all very useful information, but take a particular look at str() and repr(). All Python object

Re: Best python module for Oracle, but portable to other RDBMSes

2006-03-03 Thread dananrg
>[EMAIL PROTECTED] wrote: > dananrg> Are you saying I'm getting the "L" as an artifact of printing? > > No, you're getting the "L" because you're printing a long integer. If you > execute > > x = 872L > y = 872 > > at a Python prompt, x will be a long integer and y will be an integer. Lon

Re: Write a GUI for a python script?

2006-03-03 Thread Jeff Quandt
Title: Re: Write a GUI for a python script? Glurt Wuntal (02.03.2006 15:56): > I am a newbie with Python. It's a great language, but I would like to be > able to present a simple gui menu for some of my scripts; something better > than using 'raw_input' prompts. > Another option is to u

Re: Printing a file

2006-03-03 Thread Florian Diesch
Fabian Steiner <[EMAIL PROTECTED]> wrote: > I am currently working on an application where the user is able to > create new worksheets and to delete existing ones. All of these > worksheets have the same structure (--> template?), only some values > should be changed. A minimal example would be

Re: setattr question

2006-03-03 Thread Gerard Flanagan
bruno at modulix wrote: > Gerard Flanagan wrote: > > The functions were kind of related > > and meaningless outside the module they were declared - > > FWIW (and from the snippet I saw), these functions are useless even in > the module !-) > ok, ok... :-) > Unless you want to dynamically choose t

Re: How to find cause for Python/Pythonwin crash only on Dual Core Machines ?

2006-03-03 Thread Larry Bates
robert wrote: > There is a strange freeze/crash only on dual core machines: > > I have a python app (Python 2.3.5 /Pythonwin build 203 / Windows) > running with no stability problems on normal machines (Or a crash is so > rare, that absolutely nobody obverses it, though the overall majority of > u

Re: ODBC module and strange date reference <...>

2006-03-03 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > Incidentally, I have just ordered: > > * Learning Python > * Python Cookbook > * Python Pocket Reference > > Are there any other books y'all would recommend as essential Python > references and/or books for becoming fluent in Python? Both Beazley's "Python Essential Re

Re: string stripping issues

2006-03-03 Thread Larry Bates
orangeDinosaur wrote: > Hello, > > I am encountering a behavior I can think of reason for. Sometimes, > when I use the .strip module for strings, it takes away more than what > I've specified. For example: > a = 'Hughes. John\r\n' > a.strip('') > > returns: > > 'ughes. John

cx_Freeze 3.0.2 and Linux sax problem.

2006-03-03 Thread 1stpoint
I am banging my head against the wall. I have a Web application server that uses xml.sax. When I build it using FreezePython I get the following error when trying to use it: File "/usr/lib/python2.3/site-packages/_xmlplus/sax/sax2exts.py", line 37, in make_parser File "/usr/lib/python2.3/site-p

Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Cassiano, Marco
I have difficulties with a weird Python 2.4.2 behaviour in comparing Decimal to Floats. For Example : >>> from decimal import Decimal >>> a=Decimal('3.7') >>> b=6.3 >>> if a > b :print a,b,'a is greater than b - NOT TRUE' ... else: print a,b,'b is greater than a - CORRECT' ... 3.7 6.3 a

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Steve Holden
Cassiano, Marco wrote: > I have difficulties with a weird Python 2.4.2 behaviour in comparing Decimal > to Floats. > > For Example : > > > from decimal import Decimal a=Decimal('3.7') b=6.3 > > if a > b :print a,b,'a is greater than b - NOT TRUE' > > ... else: print a,b,

Re: scipy

2006-03-03 Thread Robert Kern
computer1 wrote: > I want to install scipy 0.4.6 (windows)on my computer ,but i cannot > download it from www.scipy.org. who can tell me another place to > download it? http://www.scipy.org/Download links to the Sourceforge download site. I assume that you are trying to download the files by simp

Re: how do you move to a new line in your text editor?

2006-03-03 Thread John Salerno
Mc Osten wrote: > On Thu, 02 Mar 2006 18:58:50 GMT, John Salerno wrote: > >> I use UltraEdit right now, and it is possible to convert spaces and tabs >> back and forth, but it's just an extra step. > > I wouldn't definitely suggest UltraEdit to code Python. Why do you say that? -- http://mail.

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Fredrik Lundh
"Cassiano, Marco" wrote: > I have difficulties with a weird Python 2.4.2 behaviour in comparing > Decimal to Floats. > > For Example : > > > >>> from decimal import Decimal > >>> a=Decimal('3.7') > >>> b=6.3 > > >>> if a > b :print a,b,'a is greater than b - NOT TRUE' > ... else: print a,b,'b

  1   2   3   >