tmthydvnprt
tmthydvnprt

Reputation: 10758

Force iPython %cd magic command to not print path

iPython %cd magic command

Can the %cd magic command in iPython be made to not show the output path? If you pass a relative path or start from a shortcut ~/, this can be nice when sharing notebooks, but the output shows a full path which may not be relevant to the audience.

In [1]: %cd ~/GitHub/someplace
/Users/accountname/GitHub/someplace

In [2]: |

It would be nice to either return nothing or return the relative path...

Upvotes: 2

Views: 628

Answers (1)

tmthydvnprt
tmthydvnprt

Reputation: 10758

Quiet iPython %cd magic command

The iPython magic command provides a quiet option. Use the -q option to not display the output.

In [1]: %cd -q ~/GitHub/someplace

In [2]: |

Upvotes: 4

Related Questions