Search code examples
pythongoogle-visualization

Assign a list to variables


I have a python list:

x = ['aa', 'bb', 'cc']

The len() (or list length, which is 3 in this case) of this list can be any number, as it is basically coming from database. My question is: how can I assign each string member of this list into a separate variable automatically? The point over here is: I do not know the number of elements in the list, since they are always different.

Once this is resolved, I am trying to put it into a Python Google Charting (GChartWrapper's pie3d chart) function like this:

G.label(aa,bb,cc)

However, if I simply put the list in like:

G.label(x)

then it is naming only one section of the pie chart as the complete list.


Solution

  • You're doing it wrong.

    G.label(*x)