notebook icon indicating copy to clipboard operation
notebook copied to clipboard

how to automatically add blank space besides "="

Open zdlspace0528 opened this issue 3 years ago • 4 comments
trafficstars

Dear all,

When I type x=1 in jupyter notebook, how can I automatically add blank space between =,that is to say "x = 1" . Also,when I type x>1, I hope it can type as "x > 1".

Best, Raymond

zdlspace0528 avatar May 06 '22 06:05 zdlspace0528

Hello, If you are assigning 1 to x, what difference does the blank space make? compiler skips through the blank spaces anyway, If you meant something else, do let me know. Similarly, x>1 will return true/false on basis of value of x, the blank space will not change a thing.

parthmahe avatar May 11 '22 20:05 parthmahe

@zdlspace0528 I see you want to style your code in PEP8 style. You can do this by installing an extension and it automatically does that for all the cells.

hakunamatata1997 avatar Nov 16 '22 06:11 hakunamatata1997

Hi, does anyone know which part of the repository/code needs to be edited to fix this issue? I am currently trying to work on it right now to add a space before and after the inequality symbols like OP wants. I would appreciate any help!

gokulmuralidharan avatar Feb 02 '24 23:02 gokulmuralidharan

I see you want to style your code in PEP8 style. You can do this by installing an extension and it automatically does that for all the cells.

Right, this sounds more like a styling issue than something that should be implemented in Jupyter Notebook.

There should be a couple linting extensions out there to format your code as you type (or on save), like with other IDEs. For example https://github.com/ryantam626/jupyterlab_code_formatter.

Maybe that would work for you use case? Or have you seen such feature in other editors available by default?

jtpio avatar Feb 05 '24 17:02 jtpio