What's the difference between spend on and spend in?

Most time I used spend on in the case like: I spent 5 hours on learning Python everyday.

But, I happened to see a sentence: I spent a lot time in researching the problem. So I am curious about the difference between them?

Thanks in advance.


Prepositions are necessary, of course, but overuse can make writing sound passive and fussy. For example, the U.S. government has a plain language mandate, and when they talk about omitting unnecessary words, they specifically call out prepositions as a potential problem, saying “Watch out for of, to, on, and other prepositions. They often mark phrases you can reduce to one or two words.”

I see both 'in' and 'on' as superfluous in these particular sentences. I'd suggest instead: "I spent 5 hours learning Python everyday." and "I spent a lot of time researching the problem."