我需要将param传递给文件sh中的python函数
我的数组是这样的:
$ echo $myarr
0, 17, 25, 28, 11, 19, 15, 2, 2, 2, 23, 27, 27, 8, 24, 15, 7, 13, 18, 27, 1, 23, 30, 21, 26, 19, 17, 27, 31, 25, 19, 6, 13
python函数是like,它的输出是
$ python -c 'import bech32; print bech32.bech32_create_checksum("tb", ['$myarr'] )'
File "<string>", line 1
import bech32; print bech32.bech32_create_checksum("tb", [0,
^
SyntaxError: unexpected EOF while parsing
如果我使用数组(不带变量),它可以工作
$ python -c 'import bech32; print bech32.bech32_create_checksum("tb", [0, 17, 25, 28, 11, 19, 15, 2, 2, 2, 23, 27, 27, 8, 24, 15, 7, 13, 18, 27, 1, 23, 30, 21, 26, 19, 17, 27, 31, 25, 19, 6, 13] )'
[10, 9, 20, 29, 27, 15]
Here您可以看到python函数
将单引号与python cmd一起使用是错误的,因为它打断了行。由此产生了第一个错误。除此之外,要将param传递给python cmd,可以执行以下操作:
相关问题 更多 >
编程相关推荐