gpt4 book ai didi

python - 如何在 bash 中提示用户输入?请修复我的 python/bash 西类牙式英语

转载 作者:行者123 更新时间:2023-11-28 23:03:51 24 4
gpt4 key购买 nike

对不起。我对此很陌生,找不到直接的答案。在 python 中我可以说:

from sys import argv
script, user_name = argv
prompt'> '
print "Hi %s, I'm the %s script" % (user_name, script)
print "I'd like to ask you a few questions"
print "What channel is that on?"
channel = raw_input(prompt)
blah blah -c %r % (channel)

我需要能够在常规 bash (.sh) shell 脚本中使用 raw_input() 完成相同的事情或者我需要能够从 python 脚本中操作其他程序我需要能够从 python 脚本中启动第二个 shell (bash)。

请温柔点。

最佳答案

我猜你正在寻找 read内部命令

echo -n "What channel is that on? ";
read channel;

或者更简洁

read -p "What channel is that on? " channel

关于python - 如何在 bash 中提示用户输入?请修复我的 python/bash 西类牙式英语,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8279795/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com