1 回答
- 最新
- 投票最多
- 评论最多
0
【以下的回答经过翻译处理】 你可以像使用常规的Python sys.argv参数一样读取参数。
import sys
print "This is the name of the script: ", sys.argv[0]
print "Number of arguments: ", len(sys.argv)
print "The arguments are: " , str(sys.argv)
或者,你可以使用Glue的getResolvedOptions按名称读取参数。在这种情况下,你需要在参数名前加上“--”例如 --Arg1 Value1
from awsglue.utils import getResolvedOptions
args = getResolvedOptions(sys.argv, ['TempDir','JOB_NAME', 'Arg1'])
print "The args are:",str(args)
print "The value is:",args['Arg1']