I try to paste several lines of python commands after for loop in Jupyter notebook. However, and my code has the follwoing configuration:
for v in var: First line second line third line ...
without the required indentation of for loop. How to paste the lines (first, second, ...) after for command to have the following indentation:
for v in var: First line second line third line ...
I try to paste several lines of python commands after for loop in Jupyter notebook. However, and my code has the follwoing configuration:
for v in var: First line second line third line ...
without the required indentation of for loop. How to paste the lines (first, second, ...) after for command to have the following indentation:
for v in var: First line second line third line ...Share Improve this question asked Feb 5 at 19:35 H. KhaniH. Khani 1113 bronze badges 4
- 4 highlight the lines to be indented and press tab. – Mark Tolonen Commented Feb 5 at 19:40
- @MarkTolonen is right - the pasted code will preserve whatever indentation it had when copied, so you'll have to fix it yourself. Or, if possible, properly format the source of the code before copying it. – JRiggles Commented Feb 5 at 20:05
- Thanks, do you mean I have to press manually spaces in each line before the command? It seems unusual and would take a lot of time. – H. Khani Commented Feb 5 at 20:14
- 1 No, you dont need to manually press spaces in each line. Just do what Mark suggested in his comment – Cincinnatus Commented Feb 5 at 20:16
1 Answer
Reset to default 1For Jupyter notebook the keybind to change indentation is CTRL+ { and CTRL + }. Highlight the lines you wish to change.