默认/可编辑字符串到raw_input [英] Default/editable string to raw_input

查看:74
本文介绍了默认/可编辑字符串到raw_input的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这是我在列表中的第一篇帖子,希望有人可以帮我解决这个

问题。如果它之前已被发布但我已经上网,请致歉

搜索无济于事。


我想要做的是提供一个简单的方法用户为测试套件更改

配置文件。

配置文件包含许多键,例如。内置号码,目标

设备等


我想做的是给用户一个键,以及之前的值

表示该键。

然后用户可以接受上一个值或在行上编辑它。


我有一个方法,其中包含前一个值一个密钥被提交给

用户,如果用户点击返回,则可以接受。但是由于某些

值有些长,并且用户可能只需要更改1或2

字符,因此提供行编辑将是一个不错的功能。


我可以获得readline.set_pre_input_hook()函数,在

a raw_input提示后发送文本,但是这个文本无法编辑。


在此先感谢您的帮助。

Paraic。

Hi,

This is my first post to the list, I hope somebody can help me with this
problem. Apologies if it has been posted before but I have been internet
searching to no avail.

What I am trying to do is provide a simple method for a user to change a
config file, for a test suite.
The config file consists of a number of keys, eg. build number, target
device, etc.

What I would like to do is give the user a key, and the previous value
for that key.
The user can then accept the previous value or edit it on the line.

I have a method where the previous value of a key is presented to the
user and can be accepted if the user hits return. But as some of the
values are somewhat long, and the user may only need to change 1 or 2
characters, it would be a nice feature to offer line editing.

I can get the readline.set_pre_input_hook() function to send text after
a raw_input prompt, but this text cannot be edited.

Thanks in advance for any help.
Paraic.

推荐答案

Paraic Gallagher启发我们:
Paraic Gallagher enlightened us with:
我要做的是为用户提供一种简单的方法来更改配置文件,用于测试套件。
What I am trying to do is provide a simple method for a user to
change a config file, for a test suite.




我的意见是:让用户使用他/她的
最喜欢的文本编辑器编辑配置文件。配置测试套件的人应该

当然可以编辑文本文件。


Sybren

-

世界的问题是愚蠢。并不是说应该对愚蠢的死刑进行处罚,但为什么我们不要仅仅拿掉

安全标签来解决问题呢?
Frank Zappa



My opinion: let the user edit the configuration file using his/her
favourite text editor. Someone configuring a test suite should
certainly be able to edit a text file.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don''t we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa


Sybren Stuvel写道:
Sybren Stuvel wrote:
我的观点:让用户编辑配置文件使用他/她最喜欢的文本编辑器。配置测试套件的人当然应该能够编辑文本文件。

Sybren
My opinion: let the user edit the configuration file using his/her
favourite text editor. Someone configuring a test suite should
certainly be able to edit a text file.

Sybren



虽然我同意委托人你的意见,这个想法是一个绝对的b $ b $ moron

能够以最小的努力配置一个测试单元




此外,我很好奇是否有其他人知道是否有问题解决方案。


Paraic。


While I agree in principal to your opinion, the idea is that an absolute
moron
would be able to configure a testcell with smallest amount of effort
possible.

Moreover, I am curious as to whether somebody else out there knows if
there is a solution to the problem.

Paraic.


Paraic Gallagher启发我们:
Paraic Gallagher enlightened us with:
虽然我同意你的意见,但我的想法是绝对白痴将能够配置尽可能小的努力量的测试单元。


然后向我解释为什么学习如何使用你的程序来编辑

文件比使用已经熟悉的程序更容易。

此外,我很好奇是否有其他人知道
是否有问题的解决方案。
While I agree in principal to your opinion, the idea is that an
absolute moron would be able to configure a testcell with smallest
amount of effort possible.
Then explain to me why learning how to use your program to edit the
file is easier than using an already familiar program.
Moreover, I am curious as to whether somebody else out there knows
if there is a solution to the problem.




给出默认答案'当用户按下后输入

而不提供他自己的答案时选择。


Sybren

-

世界的问题是愚蠢。并不是说应该对愚蠢的死刑进行处罚,但为什么我们不要仅仅拿掉

安全标签来解决问题呢? br />
Frank Zappa



Give a default answer that''s chosen when the user presses enter
without providing an answer of his own.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don''t we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa


这篇关于默认/可编辑字符串到raw_input的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆