How enable auto-format code for PyCharm?

已回答

Is it possible in PyCharm after typing ';' or press 'Enter' happened formatting of this string?

For instance, to:

a+b=10;

after:

a + b = 10;

Or only possible option: Code > Reformat Code...?

Thank you!

ACES ETM

0

Hi! I am a bit confused by the example. Is it Python or just some artificial example? Could you please describe the usecase in more detail?

a+b=10

Generally speaking, I don't think PyCharm has such a feature built-in, unfortunately.

If you are worried about accidentally committing a wrongly styled code, perhaps a commit hook or an option in UI to trigger the format on commit can help?

0

pip install black,and enable it in the setting,this can reformat automally when the file is saved 

0

请先登录再写评论。