有人知道一个简单的库或函数来解析csv编码的字符串并将其转换为数组或字典吗?
我不认为我想要内置的csv模块,因为在我看到的所有示例中都采用了文件路径,而不是字符串.
最终我理解这一点,它的确有效.
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
Run Code Online (Sandbox Code Playgroud)
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]
Run Code Online (Sandbox Code Playgroud)
谢谢