环境:Python3.5
- [root@xiaoshui 23:52:22~/test]# ll
- total 16
- drwxr-xr-x. 2 root root 4096 Feb 22 22:45 sed
- -rwxr-xr-x. 1 root root 105 Feb 27 23:47 test01.py
- -rw-r--r--. 1 root root 41 Feb 27 23:48 test02.sh
- drwxr-xr-x. 2 root root 4096 Feb 27 23:36 tmp3
- [root@xiaoshui 23:52:25~/test]# cat test01.py
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- s1 = 72
- s2 = 85
- r = s1/s2*100
- print('rate= %0.2f%%' % r)
- [root@xiaoshui 23:52:29~/test]# cat test02.sh
- #!/bin/bash
- python /root/test/test01.py
- [root@xiaoshui 23:52:32~/test]# bash test02.sh
- rate= 84.71%
- [root@xiaoshui 23:52:35~/test]#
来源: http://www.bubuko.com/infodetail-1962365.html