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

309
Views
How to run multiline Python statement in VSCode without needing to select it all?

I want to be able to run the entirety of a multiline statement like this

dtypes = {
    'date' : 'str',
    'item_code' : 'category',
    'branch_code' : 'category',
    'sale_qty' : 'float',
    'sale_val' : 'float',
    'return_qty' : 'float',
    'return_val' : 'float'
}

by having the cursor on the first line and pressing a shortcut.

I currently have the command jupyter.execSelectionInteractive bound to ctrl+enter, however that only executes either the current line if nothing is selected or the selection. So in a statement like the one mentioned above, it would attempt to run dtypes = { only and fail with an error and I would need to manually select the whole statement to execute it.

This is a built in function in many IDEs like RStudio where if you press the shortcut for running the current line, it intelligently knows that the current line is part of a multiline statement and runs the whole statement.

I would like to know if there is a way to do this in VSCode?

I also already know that I can use the comment #%% to create Jupyter cells that I can run at once, but I don't want to have to insert #%% at every single multiline statement so I can execute it easily without selecting it all.

over 4 years ago · Santiago Trujillo
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!