Re: how to remove multiple occurrences of a string within a list?

2007-04-04 Thread Maël Benjamin Mettler
How about: list(frozenset(['0024', 'haha', '0024'])) [EMAIL PROTECTED] schrieb: On Apr 4, 2:20 am, bahoo [EMAIL PROTECTED] wrote: Hi, I have a list like ['0024', 'haha', '0024'] and as output I want ['haha'] If I myList.remove('0024') then only the first instance of '0024' is removed.

Re: [Python-Dev] Python 3000 PEP: Postfix type declarations

2007-04-01 Thread Maël Benjamin Mettler
Is this supposed to be a joke? First of April? Likely. -- http://mail.python.org/mailman/listinfo/python-list

How to delete PyGTK ComboBox entries?

2007-02-26 Thread Maël Benjamin Mettler
Hello list! I need to repopulate PyGTK ComboBox on a regular basis. In order to do so I have to remove all the entries and then add the new ones. I tried to remove all entries like that: def clear_comboboxes(boxreference): try: while True: boxreference.remove_text(0)

Re: How to delete PyGTK ComboBox entries?

2007-02-26 Thread Maël Benjamin Mettler
Hej! model = combo_box.get_model() combo_box.set_model(None) model.clear() for entry in desired_entries: model.append([entry]) combo_box.set_model(model) model.append is essentially the same as combo_box.append_text. Setting the model to None before making changes to it

Re: c++ for python programmers

2007-02-12 Thread Maël Benjamin Mettler
SAMS Teach yourself C in 21 days by Bradley L. Jones and Peter Aitken Learning C++ is not worth is in my opinion, since you can get the OOP power from Python and use C if you need speed... Thomas Nelson schrieb: I realize I'm approaching this backwards from the direction most people go, but

Re: How to access an absolute address through Python?

2007-02-11 Thread Maël Benjamin Mettler
volcano schrieb: Can it be done, and if yes - how? Define address. Are you talking about URLs? File paths? Postal addresses? Memory addresses? Whatever addresses? I'm afraid the people on this list can't read your thoughts... -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find all the same words in a text?

2007-02-11 Thread Maël Benjamin Mettler
In order to find all the words in a text, you need to tokenize it first. The rest is a matter of calling the count method on the list of tokenized words. For tokenization look here: http://nltk.sourceforge.net/lite/doc/en/words.html A little bit of warning: depending on what exactly you need to

Re: Best Free and Open Source Python IDE

2007-02-08 Thread Maël Benjamin Mettler
Srikanth schrieb: Yes, All I need is a good IDE, I can't find something like Eclipse (JDT). Eclipse has a Python IDE plug-in but it's not that great. Please recommend. Thanks, Srikanth http://www.serpia.org/spe http://www.die-offenbachs.de/detlev/eric.html --

Re: postgres backup script and popen2

2007-02-08 Thread Maël Benjamin Mettler
Use pexpect: http://pexpect.sourceforge.net/ flupke schrieb: Hi, i made a backup script to backup my postgres database. Problem is that it prompts for a password. It thought i could solve this by using popen2. I tested popen2 with dir (i'm on windows 2000, python 2.4.3) and it works.

Built-in datatypes speed

2007-02-07 Thread Maël Benjamin Mettler
Hello Python-List I hope somebody can help me with this. I spent some time googling for an answer, but due to the nature of the problem lots of unrelevant stuff shows up. Anyway, I reimplemented parts of TigerSearch ( http://www.ims.uni-stuttgart.de/projekte/TIGER/TIGERSearch/ ) in Python. I am

Re: (n)curses or tcl/tk?

2007-02-07 Thread Maël Benjamin Mettler
As far as I know Windows does not support ncurses natively (using CygWin probably changes that). So go with Tkinter. Looks crappy but at least it should run on all major platforms... Hi All, Just learning Python - my first new language for about 18 years (I'm not a programmer ...). I'm writing