Re: Sorting array

2007-12-01 Thread Tartifola
Hi, On Fri, 30 Nov 2007 14:55:08 -0600 Robert Kern [EMAIL PROTECTED] wrote: Tartifola wrote: Hi, I'm working with numerical array and I'm a little lost on a particular sorting of one of them. In particular I have an array like a = array([[8,4,1],[2,0,9]]) and I need to sort

Sorting array

2007-11-30 Thread Tartifola
Hi, I'm working with numerical array and I'm a little lost on a particular sorting of one of them. In particular I have an array like a = array([[8,4,1],[2,0,9]]) and I need to sort it using only the first column as reference but keeping the lines together so to obtain array([[2, 0, 9],

Re: No file from stdin

2007-05-25 Thread Tartifola
Hi, On May 24, 9:48 am, Tartifola [EMAIL PROTECTED] wrote: Hi, suppose a script of python is waiting for a file from the stdin and none is given. How can I make the script to stop and, for example, print an error message? Sorry for the n00b question and thanks I'm not exactly

Re: No Python for Blackberry?

2007-05-25 Thread Tartifola
Hi, I could not find a version of Python that runs on a Blackberrry. I'm in the process to buy one of this smart phone and very interested in Python for Blackberry. Any success in installing it? - This sig is dedicated to the advancement of Nuclear

No file from stdin

2007-05-24 Thread Tartifola
Hi, suppose a script of python is waiting for a file from the stdin and none is given. How can I make the script to stop and, for example, print an error message? Sorry for the n00b question and thanks -- http://mail.python.org/mailman/listinfo/python-list

Random selection

2007-05-18 Thread Tartifola
Hi, I have a list with probabilities as elements [p1,p2,p3] with of course p1+p2+p3=1. I'd like to draw a random element from this list, based on the probabilities contained in the list itself, and return its index. Any help on the best way to do that? Thanks --

Sorting Multidimesional array(newbie)

2006-12-11 Thread Tartifola
Hi, how can I sort an array like array([[5, 2], [1, 3]]) along the first column to obtain array([[1, 3], [5, 2]]) i.e. keeping track of the ordered couples? Thanks, A -- http://mail.python.org/mailman/listinfo/python-list

Simple question on indexing

2006-12-01 Thread Tartifola
Hi, I would like to obtain the position index in a tuple when an IF statement is true. Something like a=['aaa','bbb','ccc'] [ ??? for name in a if name == 'bbb'] 1 but I'm not able to find the name of the function ??? in the python documentation, any help? Thanks --