Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use paste mode in pyspark shell?

How to enter into paste mode in "pyspark" Spark Shell? Actually I am looking for an equivalent ":paste" command (works in Scala Spark Shell) in "pyspark". By using this mode, I would like to paste entire code snippet in shell rather than executing line by line.

like image 454
B Chawla Avatar asked Feb 08 '23 01:02

B Chawla


1 Answers

If you use IPython terminal you can paste using %paste / %cpaste magic. The first one executes code from the clipboard automatically, the second one is closer to Scala REPL :paste and requires termination by -- or Ctrl-D.

It is also possible to use %edit magic which opens external editor and executes code on exit.

Standard Python shell doesn't provide similar functionality.

like image 112
zero323 Avatar answered Feb 10 '23 15:02

zero323