Simple pyroot example problem

hello pyroot team

I have question about loading txt file.

here is my code

[code]import ROOT
from ROOT import TCanvas, TFile, TH1F
from ROOT import Double

c1 = TCanvas(“c1”,“c1”,900,700)
h1 = ROOT.TH1F(“h1”, “”, 10, 0, 10)
data = open(‘data.dat’,‘r’)
for x in data:
print x
x = Double()
h1.Fill(x)
data.close()
h1.Draw()[/code]

and then my data file data.dat is

1
2
3
4
10
2
4
2
3
4

the outputs included only 0.0

I’m waiting your kind answer :slight_smile:

Either:
x = Double(x); h1.Fill(x)
or simply:
h1.Fill(float(x))

Thank you Pepe Le Pew !