Re: MySQL, Python, NumPy and formatted read

2010-05-26 Thread John Nagle
Ian Hoffman wrote: Hello, I'm having significant Python difficulties (and I'm new to Python). I'm trying to read BLOB ASCII (numerical) data from a MySQL database using MySQLdb in a formatted fashion. The BLOB data is a sequence of numbers separated by newlines (\n), like this: 5 6 10 45 etc.

Re: MySQL, Python, NumPy and formatted read

2010-05-24 Thread Ian Hoffman
On May 24, 2:11 am, Dennis Lee Bieber wrote: > On Sun, 23 May 2010 21:44:30 -0700 (PDT), Ian Hoffman > declaimed the following in gmane.comp.python.general: > > > The problem is the tuple is contained in a single value separated by > > newlines (only a[0] has a record), otherwise I could do as yo

Re: MySQL, Python, NumPy and formatted read

2010-05-23 Thread Ian Hoffman
On May 23, 6:54 pm, Matteo Landi wrote: > I know anything about mysqldb and fetchone method, but it's easy to > create a numpy array, given a tuple of data: > > > > >>> import numpy > > >>> t = ('1', '2', '3') > >>> numpy.array(t, int) > array([1, 2, 3]) > > I made the assumption that mysqldb.fetc

Re: MySQL, Python, NumPy and formatted read

2010-05-23 Thread Matteo Landi
I know anything about mysqldb and fetchone method, but it's easy to create a numpy array, given a tuple of data: >>> import numpy >>> >>> t = ('1', '2', '3') >>> numpy.array(t, int) array([1, 2, 3]) >>> I made the assumption that mysqldb.fetchone return a tuple of strings, so we need to create an

MySQL, Python, NumPy and formatted read

2010-05-23 Thread Ian Hoffman
Hello, I'm having significant Python difficulties (and I'm new to Python). I'm trying to read BLOB ASCII (numerical) data from a MySQL database using MySQLdb in a formatted fashion. The BLOB data is a sequence of numbers separated by newlines (\n), like this: 5 6 10 45 etc. When I read the data