Changes

Jump to: navigation, search

OPS435 Python Lab 1

29 bytes added, 11:05, 17 May 2017
Using Magic Functions
cd ~/
ls
</source>Now hold on. Remember: You are not using Python here. These , instead, these are aliases, for Bash shell commands that IPython gives you access to. What you are actually using is bash, but not all bash commands are available in the IPython environment.<br><br>
:#Lets find out which ones are available, type the following command into the IPython shell:<source>
% alias
</source>We should now have a list of all the bash commands available in IPython. Shortly we will go over how to add new bash commands into this environment, but you must remember, these are only here to assist in your python scripting, we are not here to learn bash commands.<br><br>
:#Next lets add a new bash command that seems to be missing from this list:<source>
% alias vim vim
</source>
:#The vim command will give us our much needed syntax highlighting, while we are editing scripts from within the IPython environment. These magic %alias functions do not save in between sessions, this creates a problem since you would have to create them every time you start IPython. This will create a error:<source>
13,420
edits

Navigation menu