我生成傳遞給python -c
命令這樣通過串聯
'python -c "import '+impMod+'; help('+module+'.'+method+') if \''+method+'\' in dir('+module+') else from '+impMod+' import '+method+' help('+method+')"'
建立一個Python的命令,並得到輸出是這樣的:
python -c "import os; help(os.path.pathconf) if 'pathconf' in dir(os.path) else from os import pathconf help(pathconf)"
即使我嘗試
python -c "import os; help(os.path.pathconf) if 'pathconf' in dir(os.path) else from os import pathconf; help(pathconf)"
但不知道爲什麼我得到SyntaxError:無效的語法
任何幫助將不勝感激, 關心。
你不需要'';'' – jramirez
好吧不是這樣的話,請進一步檢查這一行,我猜它是什麼時候在介紹help後面的'from'進口pathconf' –
是的,python沒有使用這些。 – jramirez