分类: linux server, Python

在shell 脚本里嵌入python

#!/bin/bash
function pytest() {
python - $@ <<EOT
import sys,datetime
print 'Current Time is %s' % datetime.datetime.now()
print sys.argv
EOT
}


RT=$(pytest $@)
echo my python script says: $RT

Share