So I need to make changes in multiple cells in a Jupyter notebook. One of these changes is inserting a newlines in a code line.
fig = fig.update_xaxes(showgrid=True, gridwidth=0.3, gridcolor='LightBlue') fig.show()
This line of code is present in multiple cells in the notebook. I need to insert a newline before fig.show()
for the code to work.
I guess I need to use "find and replace" functionality. But I am unable to insert a new line. I have tried using the regex
But the output is \nfig.show()
.
How can I insert a newline character in multiple cells in Jupyter Notebook?
CodePudding user response:
Don't know how to add a newline, but two possible workaraounds for your case:
Replace
fig.show()
with(fig := fig.update_xaxes(showgrid=True, gridwidth=0.3, gridcolor='LightBlue')).show()
, i.e. chaining the two commands using the walrus operator so thatfig
is also updatedPut a
;
between both commands: Replacefig.show()
withfig = fig.update_xaxes(showgrid=True, gridwidth=0.3, gridcolor='LightBlue');fig.show()