Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

377
Views
How to select an answer from options in command line(terminal) using python.?

I am trying to access command line form python code. here is two example where I got stuck. In this code, there is a question and 3 or 4 options to select as answer. How can I select any of these answer using python code. In real case If I am using it from command line I have to use up and down arrow ↑ ↓ key or right and left arrow < > key then enter key to select any one of the options.

*example:1>*

? How would you like to use ESLint? … 
  To check syntax only
▸ To check syntax and find problems
  To check syntax, find problems, and enforce code style

*example:2>*

✔ How would you like to use ESLint? · problems
? What type of modules does your project use? … 
▸ JavaScript modules (import/export)
  CommonJS (require/exports)
  None of these

Normally, I have to answer it by selecting answer from list and pressing enter from terminal, is there any possibility to answer these questions by using python code?


Here I am describing my use case.

I am trying to create automate ESLint vulnerability check for TypeScript files using python.

I am able to run ESLint --init to initialise ESLint in my project. While initializing ESLint --init is asking some questions to specify the type of project. Some of the questions are following:

*example:1>*

? How would you like to use ESLint? … 
  To check syntax only
▸ To check syntax and find problems
  To check syntax, find problems, and enforce code style

*example:2>*

✔ How would you like to use ESLint? · problems
? What type of modules does your project use? … 
▸ JavaScript modules (import/export)
  CommonJS (require/exports)
  None of these

Normally, I have to answer it by selecting answer from list and pressing enter from terminal, is there any possibility to answer these questions by using python code?

following code was used to run eslint --init from python code:

def eslint_init():
    if pathlib.Path('.eslintrc.js').exists():
        print('already initialized')
    else:
        os.system('eslint --init')
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!