Changes

Jump to: navigation, search

OPS435 Python Lab 1

32 bytes removed, 10:59, 8 March 2017
Using Magic Functions
%cd ~/
%ls
</source><br><br>Now hold on. You are not using Python here. These are aliases, 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><br><br>We should now have a list of all the bash command 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
ipython3
vim
</source><br><br>You should be seeing an error telling you invalid syntax. This is happening because we need to create a config file to make this alias persist in-between sessions.<br><br>
#Exit your current IPython session:<source>
exit
ipython3
%vim
</source><br><br>At this point vim should open successfully and you should now understand how to create new IPython aliases and store them persistently. Exit vim now and head back to the IPython shell. <br><br>
#Lets setup a directory structures for completing and organizing labs. These should be the locations to store your lab scripts.<source>
%mkdir ~/ops435
13,420
edits

Navigation menu