Bin spacing in python list

Hi all.

Browsing through the internet I didn’t find the solution to this answer. So mea culpa, if this question already has been asked: how can I get the bin separation of a histogram into a python list? In my code I was doing like this:

which works perfectly in ROOT6, but not in ROOT5 which I have somewhere else installed (and I actually need to run my code there). What is the good way of doing this in ROOT5?

Thank you and cheers,
heico.

OK, so I wrote a function that iterates over the bins:

def toList(tarrayd): list = [] for i in range(tarrayd.GetSize()): list.append(tarrayd[i]) return list

It works, though I was hoping there was a more elegant way of doing this.
Any suggestions are welcome.

Cheers,
heico

Hi,

how does it fail? In the above list() call, python does under the hood exactly what you typed out below.

Cheers,
Wim