Closed. This question needs to be more focused。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗?更新问题,使其仅通过editing this post专注于一个问题。
                        
                        9个月前关闭。
                                                                                            
                
        
在显示它后,如何跳过按Enter继续操作?我知道如何通过按-y作为示例跳过按Yes / No,但是输入Enter时的解决方案是什么?
谢谢 。

最佳答案

如果可以使用命令行,则yes命令可能会有所帮助。您可以让它一遍又一遍地重复一个字符串,因此可以使用yes '\n' | yourcommand使它在运行命令时反复按换行键。

$ man yes

YES(1)                    BSD General Commands Manual                   YES(1)

NAME
     yes -- be repetitively affirmative

SYNOPSIS
     yes [expletive]

DESCRIPTION
     yes outputs expletive, or, by default, ``y'', forever.

HISTORY
     The yes command appeared in 4.0BSD.

4th Berkeley Distribution        June 6, 1993        4th Berkeley Distribution

关于python - 如何跳过按Enter键以使用python在shell命令中继续,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56709936/

10-12 19:29