About 250,000 results
Open links in new tab
  1. What are blocks of code in Python? The definitions are all …

    Apr 29, 2018 · A block is just a concept and you can't see it like as function. A block is the structure of code to separate part of the code from another part of the code. A function is a …

  2. Is there a shortcut to comment multiple lines in python using VS …

    Sep 26, 2022 · All you need to do is select that code block with your mouse, then press the following key combination: Ctrl + K then press Ctrl + C if you’re using Windows Command + K …

  3. How to comment out a block of code in Python [duplicate]

    Python does not have such a mechanism. Prepend a # to each line to block comment. For more information see PEP 8. Most Python IDEs support a mechanism to do the block-commenting …

  4. How to organize Python code into collapsable / expandable chunks?

    Jul 11, 2019 · A “code cell” is a block of lines to be executed all at once in the integrated Python console. You can define cells simply by adding inline comments #%% to your regular Python …

  5. How do I create multiline comments in Python? - Stack Overflow

    Apr 9, 2022 · For commenting out multiple lines of code in Python is to simply use a # single-line comment on every line: # This is comment 1 # This is comment 2 # This is comment 3 For …

  6. Pycharm: run only part of my Python file - Stack Overflow

    May 3, 2014 · For example in Spyder, we can write "#%%" at the beginning and end of the code section and we can execute it in console with Ctrl+Enter without having to select it. – Kanmani …

  7. Deactivate code in python without changing indentation or adding ...

    Jan 29, 2016 · Move the code to a new function in a new module. Create a second module which contains the same function but empty. Switch between the two modules in import; Create a …

  8. How can I time a code segment for testing performance with …

    $ python -mtimeit "all(True for _ in range(1000))" 2000 loops, best of 5: 161 usec per loop $ python -mtimeit "all([True for _ in range(1000)])" 2000 loops, best of 5: 116 usec per loop Run …

  9. Block scope in Python - Stack Overflow

    Mar 17, 2016 · The idiomatic way in Python is to keep your functions short. If you think you need this, refactor your code! :) Python creates a new scope for each module, class, function, …

  10. How do I unindent blocks of code in Python? [duplicate]

    I am using Python 2.7.10 and am having trouble trying to unindent a block of code. Surely there is some sort of shortcut, instead of having to backspace every individual line? From the Python …

Refresh