[英]How can I make Travis CI use input() in python?
我只是在学习 python 并且正在制作一个简单的文本游戏,我在里面有这个: cave = input()
,我怎样才能让 Travis 输入一些东西?
I̶ ̶j̶u̶s̶t̶ ̶d̶e̶l̶e̶t̶e̶d̶ ̶t̶h̶e̶ ̶ ̶i̶n̶p̶u̶t̶(̶)̶
̶ ̶a̶n̶d̶ ̶r̶e̶p̶l̶a̶c̶e̶d̶ ̶i̶t̶ ̶w̶i̶t̶h̶ ̶t̶h̶e̶ ̶v̶a̶r̶i̶a̶b̶l̶e̶ ̶I̶ ̶w̶a̶n̶t̶e̶d̶ ̶i̶n̶ ̶a̶ ̶n̶e̶w̶ ̶f̶i̶l̶e̶ ̶I̶ ̶m̶a̶d̶e̶,̶ ̶t̶h̶e̶n̶ ̶I̶ ̶t̶e̶s̶t̶e̶d̶ ̶t̶h̶a̶t̶我刚删除的̶
̶i̶n̶p̶u̶t̶(̶)̶
̶并替换它与可变我想在新文件中我提出,然后̶我测试了
A better way is to use the environment variables, so you just change the travis.yml file.更好的方法是使用环境变量,因此您只需更改 travis.yml 文件。
For example change cave = input()
to cave = os.eviron['cave']
when in your tavis.yml file it says例如,当在 tavis.yml 文件中时,将
cave = input()
更改为cave = os.eviron['cave']
env:
global:
- cave=4
Don't forget to import os
at the start of your script.不要忘记在脚本开始时
import os
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.