Code cells in pycharm
已回答
Hi folks. I am new to pycharm, I have been using Spyder for a while and there is a characteristic of the latter IDE that I'd to know if it exists in pycharm. Spyder allows you to create code cells, if you type the following in the middle of a script:
#%%
foo()
#%%
Then you can execute just the code between the '#%%', does pycharm have any equivalent feature?
请先登录再写评论。
Please see https://www.jetbrains.com/help/pycharm/jupyter-notebook-support.html
and https://www.jetbrains.com/help/pycharm/matplotlib-support.html
Note that it is available in PyCharm Professional only.
It works much the same as you described for Spyder, you just have to use ## instead of #%%.
Isn't there also an option in PyCharm to have code cells in a regular source file rather than a Juypter notebook file inside PyCharm?
I sport a faint memory of such functionality but couldn't find it documented again now.
When I copy-paste a notebook in PyCharm into a .py file in PyCharm, I get `# %%` lines, in case there is any relation …
Matan you need to have the View | Scientific Mode enabled for that. Note that we'll soon deprecate it and the “run” buttons will be showed next to “#%%” by default.
Sounds great. Do you mean that scientific mode will be deprecated? I never felt that it adds much so I'm happy if anything that it did becomes an optional part of the usual flow.