current position:Home>Spring boot calls Python interface

Spring boot calls Python interface

2022-02-01 22:48:46 aikutwo

One 、 Preface

SpringBoot As a back-end development framework , It has powerful and convenient processing ability . But as a combination of data analysis + For the website displayed at the front desk , The back-end data processing module uses python Scripts should be more convenient .

This paper mainly introduces how to use Springboot The framework calls python Script

Two 、 Method

In fact, in a word, it is to use springboot(Java) From the command line in , Go straight to the code .

1、 Code

python Files can be placed anywhere , However, if subsequent deployment is required, it is recommended to put it in springboot Under its own static folder Directory

stay springboot Insert method in

image.png

  • python Code in file

image.png

For testing purposes , You can put springboot The method in is temporarily put into application in

2、 function

  • For the sake of demonstration, I copied the code in the method to application in , After running, you can see in demo A... Has been generated under the folder txt file

image.png

The above is the whole content of this article , Using the method introduced in this paper, we can quickly call Python Interface to process back-end data more conveniently , Can effectively improve work efficiency , If you are interested in learning more programming skills, you can watch Teaching video Continue to learn ~

copyright notice
author[aikutwo],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/02/202202012248442610.html

Random recommended