Problems returning data from embedded Python
Cromulent
cromulent at justextrememetal.com
Mon Aug 11 11:58:00 EDT 2008
Okay I'm having a few issues with this and I can't seem to get it
sorted out (most likely due to my inexperience with Python).
Here is my Python code:
def fileInput():
data = []
s = raw_input("Please enter the filename to process (enter full path
if not in current directory): ")
fd = open(s, "r")
fd.readline()
line = fd.readlines()
for record in line:
record = record.strip()
items = record.split(',')
for i in range(1, 5):
items[i] = float(items[i])
items[5] = int(items[5])
data.append(items)
fd.close()
return items
It works perfectly and does exactly what I want it to do. The problem
comes when I try and convert the data I returned from the Python script
and turn it into something useable in C.
I have no idea. The C functions that seem most use deal with Tuples,
when this is a list and I can't see any specific functions for dealing
with lists in the C API. Can anyone give me some pointers in the right
direction at all please? I know the C program has received the data
correctly, I just need to put it in C types.
Thank you.
--
"I disapprove of what you say, but I'll defend to the death your right
to say it." - Voltaire
More information about the Python-list
mailing list