Different answers from python API and lightning-cli on 'listchannels & # 39;

I have some strange results in comparing the node information outputs between cli and python API. Maybe someone has thoughts about what's wrong (with my trivial code or with c-lightning itself):

chans = lnd.listchannels (source = mychan)['channels']
for chan in chans:
if chan['active'] == False:
total_inactive + = 1
print (inactive channel with node: + channel['destination'])
other:
total_active + = 1

print (my inactive channels: & # 39; + str (total_inactive))
print (my active channels: & # 39; + str (total_active))

Give me:

my inactive songs: 2
my active songs: 23

But lightning-cli getinfo gives:

"num_active_channels": 25,
"num_inactive_channels": 5,