Converting fpmi.gui.getWindowNames() to dataset

I want to put the results from fpmi.gui.getWindowNames() into a list. I made serveral incorrect attempts at trying to do this but I am still having difficulty figuring it out. I read through the old and new manuals but I still have a mental block.

How do you take the return list of strings and convert it to a dataset?

Thanks,

names = fpmi.gui.getWindowNames() rows = [[wname] for wname in names] dataset = fpmi.dataset.toDataSet(["Windows"], rows)

Just what I needed. I’m glad I never posted what I was trying. You just replaced a half page of code with one line. Sooner or later I will get the hang of this.
Thank you,

Yeah that middle line is a list comprehension. It is the equivalent of doing this:

names = fpmi.gui.getWindowNames() rows = [] for wname in names: rows.append([wname]) dataset = fpmi.dataset.toDataSet(["Windows"], rows)

List comprehensions are a little much for most beginners, but once you get the hang of them, they sure are efficient (to write).