您的位置:首页 > 编程语言 > Python开发

java调用python文件中的方法

2017-11-20 10:45 302 查看
    List<String> res = new ArrayList();

        try{        

            String[] ars = new String[] { "python", "C:\\comm\\loraPrt.py", "欢", "0", "0", "0"};            

            Process pr = Runtime.getRuntime().exec(ars);

            

            pr.waitFor();

            BufferedReader in = new BufferedReader(new InputStreamReader(pr.getInputStream()));

            String line="";

            while ((line = in.readLine()) != null) {

                System.out.println("ab"+line);

            }

            in.close();

            pr.waitFor();

            System.out.println("end");

        }catch(IOException e){

            e.printStackTrace();

        }catch(InterruptedException e){

            e.printStackTrace();
        }

lora_interface(sys.argv[1], int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]))

        
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: