The learning time and location distribution of students in online learning has dynamic characteristics, this paper proposes the concepts of time entropy and location entropy to quantitatively analyze the temporal and spatial distribution of students and their changing characteristics. The regularity analysis of online learning behavior is carried out by using actual entropy, and the graph model is used to model the learning process data. Through online learning behavior clustering, the learning status of different categories of learners is mined. Based on real online learning data, the behavioral patterns of online programming course learners are explored, and corresponding learning behavior intervention strategies are proposed based on the research results. The results show that “anytime” learning usually represents a higher level of learning engagement and a greater chance of achieving good learning outcomes. However, “anywhere” learning is negatively correlated with learning outcomes, i.e., frequent changes in learning location are not conducive to good learning outcomes. Based on the online learning behaviors, the students were clustered into high-involvement, random-engagement and low-involvement types, and their mean scores in the regular experiments were 90.94, 80.02 and 70.23 respectively, and their mean scores in the final exams reached 88.03, 76.07 and 64.12 respectively, which indicated that those who performed well in the final programming test had already shown some advantages in the regular experiments.