Re: Read Binary data

2008-09-04 Thread mblume
Am Thu, 04 Sep 2008 18:03:54 +0200 schrieb Fredrik Lundh: > >> I am trying to read a binary file [...] > > > f = open("a.bin", "rb") # read binary data > s = f.read() # read all bytes into a string > > import array, sys > > a = array.arra

Re: Read Binary data

2008-09-04 Thread Mars creature
'); fclose(fid);, and > > wondering how to do it in Python. I googled it but still get > > confused. > > 'b' in fopen is for 'big-endian', 'real*8' in fwrite is for 64bit > > float. > > f = open("a.bin", "rb")

Re: Read Binary data

2008-09-04 Thread Fredrik Lundh
x27;b' in fopen is for 'big-endian', 'real*8' in fwrite is for 64bit float. f = open("a.bin", "rb") # read binary data s = f.read() # read all bytes into a string import array, sys a = array.array("f", s) # "f" for float if sys.byteorder != "big": a.byteswap() -- http://mail.python.org/mailman/listinfo/python-list

Read Binary data

2008-09-04 Thread Mars creature
Hi guys, I am trying to read a binary file created by the following matlab command: fid=fopen('a.bin','w','b'); fwrite(fid,a,'real*8'); fclose(fid);, and wondering how to do it in Python. I googled it but still get confused. 'b' in fopen is for 'big-endian', 'real*8' in fwrite is for 64bit floa

Re: Read binary data from MySQL database

2007-05-10 Thread Stefan Sonnenberg-Carstens
On Do, 10.05.2007, 16:19, Christoph Krammer wrote: > Hello, > > I try to write a python application with wx that shows images from a > MySQL database. I use the following code to connect and get data when > some event was triggered: > > dbconn = MySQLdb.connect(host="localhost", user="...", passwd=

Re: Read binary data from MySQL database

2007-05-10 Thread Carsten Haese
On Thu, 2007-05-10 at 07:19 -0700, Christoph Krammer wrote: > Hello, > > I try to write a python application with wx that shows images from a > MySQL database. I use the following code to connect and get data when > some event was triggered: > > dbconn = MySQLdb.connect(host="localhost", user="..

Read binary data from MySQL database

2007-05-10 Thread Christoph Krammer
Hello, I try to write a python application with wx that shows images from a MySQL database. I use the following code to connect and get data when some event was triggered: dbconn = MySQLdb.connect(host="localhost", user="...", passwd="...", db="images") dbcurs = dbconn.cursor() dbcurs.execute("""