Text sentiment analysis is a crucial part of natural language processing, and Chinese Jieba Segmentation based on Python Technology is an important preprocessing operation of natural language processing. We use python web crawler technology to perform samples pretreating, obtain the number of positive and negative words and measure corporate social responsibility tone of peer companies (Peer CSR tone hereafter). On this basis, we empirically tests the impact of peer CSR tone and target companies’ green innovations. We find that peer CSR tone has a significantly positive relationship with green innovations of target companies. The analysis of the effects channel suggests that their relationship can be realized through social learning mechanisms and social competition mechanisms. Further, compared with non-state-owned enterprises, the peer CSR tone has a more significant impact on the green innovations of state-owned enterprises. The research is of great significance to expand the application of python web crawler technology and enhance corporate green innovations. It is also a further application of Python in the field of text sentiment analysis.