You can serialize the data in python using the struct.pack function, in C you can then unpack this information again using the union data type. I will give short codes in both languages on how to do both parts. The reverse is also possible and should be easy for you to do yourself should you require it. Remember that when you're sending doubles instead of floats you need to read 8 bytes in the C code each time.
In Python:
import struct
doublesArray = [5.0, 1.2, 3.4, 8.6]
file = open("transferdata", "wb")
for i in range(len(doublesArray)):
file.write(struct.pack('f', doublesArray[i]))
In C. By the way I took this code from this post:
#include <stdio.h>
#include <stdlib.h>
union
{
char asBytes[4];
float asFloat;
} converter;
int main(void)
{
FILE *fileptr;
char *buffer;
long filelen;
fileptr = fopen("transferdata", "rb");
fseek(fileptr, 0, SEEK_END);
filelen = ftell(fileptr);
rewind(fileptr);
buffer = (char *)malloc((filelen+1)*sizeof(char)); // Enough memory for file + \0
fread(buffer, filelen, 1, fileptr); // Read in the entire file
fclose(fileptr);
int i = 0;
while(i < filelen)
{
converter.asBytes[0] = buffer[i];
converter.asBytes[1] = buffer[i + 1];
converter.asBytes[2] = buffer[i + 2];
converter.asBytes[3] = buffer[i + 3];
i += 4;
char msg[32];
snprintf(msg, 32, "%f ", converter.asFloat);
printf(msg);
}
return 1;
}
[EDIT]: I see I wrote the exact opposite of what you need. I did not do that on purpose. However, I think you have enough information to figure out how to do the reverse on your own now.