MySQL, Python, NumPy and formatted read

Ian Hoffman ith140 at gmail.com
Mon May 24 21:23:37 EDT 2010


On May 24, 2:11 am, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Sun, 23 May 2010 21:44:30 -0700 (PDT), Ian Hoffman <ith... at gmail.com>
> 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 you
> > suggest...
>
> >>> blob = "1\n2\n3\n4\n"
> >>> tple = (blob,)
> >>> tple
> ('1\n2\n3\n4\n',)
> >>> values = [int(f) for f in tple[0].split()]
> >>> values
> [1, 2, 3, 4]
>
> --
>         Wulfraed                 Dennis Lee Bieber         AF6VN
>         wlfr... at ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Perfect!  Thanks for your help.  When I tried to do what you did, I
had explictly tried to for it as an array by using the array keyword
in from of the loop.  Everything works, and now I can move on to my
next problem.

Ian



More information about the Python-list mailing list