Can I access python variables within a `%

前端 未结 5 775
青春惊慌失措
青春惊慌失措 2020-12-12 17:55

Is there a way to access variables in the current python kernel from within a %%bash or other %%script cell?

Perhaps as command line argume

5条回答
  •  时光说笑
    2020-12-12 18:22

    Just to note a variation, if you need to pass something other than a simple variable to the bash script:

    %%bash -s $dict['key1'] $dict['key2'] $dict['key3']
    

    goes gruesomely wrong, but

    %%bash -s {dict['key1']} {dict['key2']} {dict['key3']}
    

    works nicely.

提交回复
热议问题