相关疑难解决方法(0)

如何在ncurses屏幕中输入单词?

我试图首先使用raw_input()函数,但发现它与ncurses兼容.
然后我尝试了window.getch()功能,我可以在屏幕上输入和显示字符,但无法实现输入.我如何输入一个单词ncurses并可以使用if语句来评估它?

例如,我想知道这一点ncurses:

import ncurses
stdscr = curses.initscr()

# ???_input = "cool" # this is the missing input method I want to know
if ???_input == "cool":
    stdscr.addstr(1,1,"Super cool!")
stdscr.refresh()
stdscr.getch()
curses.endwin()
Run Code Online (Sandbox Code Playgroud)

python ncurses

5
推荐指数
1
解决办法
1万
查看次数

Python:一行中的“打印”和“输入”

如果我想在python文本之间添加一些输入,如何在用户输入内容并按Enter键之后切换到新行而又不这样做呢?

例如:

print "I have"
h = input()
print "apples and"
h1 = input()
print "pears."
Run Code Online (Sandbox Code Playgroud)

应该修改为在一行输出到控制台,说:

I have h apples and h1 pears.
Run Code Online (Sandbox Code Playgroud)

应该将其放在一行上这一事实没有更深的目的,这是假设的,我希望它看起来像那样。

python printing input line

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×2

input ×1

line ×1

ncurses ×1

printing ×1