[Python] Passing IPython variables as arguments to bash commands

Discussão em 'Python' iniciado por Stack, Março 1, 2025.

  1. Stack

    Stack Membro Participativo

    How do I execute a bash command from Ipython/Jupyter notebook passing the value of a python variable as an argument like in this example:

    py_var="foo"
    !grep py_var bar.txt


    (obviously I want to grep for foo and not the literal string py_var)

    Continue reading...

Compartilhe esta Página