Hi, while retriving data from csv file to populate the listbox, i got the ironpython,runtime.list appearing in my listbox? How do I convert this list?. Working with Rhino python.
Hello,
Can you share an example of your code? Is your list of data inside another list?
Hi, code example as below
#read from csv
def getkeylist(keylist):
with open("204 P18.csv") as csvfile:
reader = csv.reader(csvfile)
for k in reader:
keylist.append(k)
def main():
keylist = []
getkeylist(keylist)
result = rs.ListBox(keylist, "Select key")
if( __name__ == "__main__" ):
main()
Thank you
Yes it is a problem with nested lists : try this!
#read from csv
def getkeylist(keylist):
with open("204 P18.csv") as csvfile:
reader = csv.reader(csvfile)
for k in reader:
keylist.append(k[0])
def main():
keylist = []
getkeylist(keylist)
result = rs.ListBox(keylist, "Select key")
if( __name__ == "__main__" ):
main()
or keylist.append(','.join(k))
if you have multiple items per line
Hi Graham,
Works perfect, small change big difference, next drink on me. Thanks again.
1 Like