【发布时间】:2011-11-23 04:16:59
【问题描述】:
最终我明白了这一点并且它起作用了。
bash 脚本:
#!/bin/bash
#$ -V
#$ -cwd
#$ -o $HOME/sge_jobs_output/$JOB_ID.out -j y
#$ -S /bin/bash
#$ -l mem_free=4G
c=$SGE_TASK_ID
cd /home/xxx/scratch/test/
FILENAME=`head -$c testlist|tail -1`
python testpython.py $FILENAME
python 脚本:
#!/bin/python
import sys,os
path='/home/xxx/scratch/test/'
name1=sys.argv[1]
job_id=os.path.join(path+name1)
f=open(job_id,'r').readlines()
print f[1]
谢谢
【问题讨论】:
-
argparse模块的哪一部分让您感到困惑? docs.python.org/dev/library/argparse.html。它有助于就您的代码遇到的问题提出更多具体问题。请使用argparse发布代码并提出具体问题。 -
将其作为命令行参数传递,然后将其从 sys.argv 中拉出。