Changes

Jump to: navigation, search

OPS435 Python Lab 1

53 bytes added, 17:59, 17 May 2017
Using Magic Functions
:#To access the '''ipython''' shell, issue the following command:<source>
ipythonipython3
</source>Now we are now inside the IPython environment. We can run some basic bash commands within this shell by issuing IPython magic functions. <br>
:#Lets try a few commands out now:<source>
:#The vim command will give us our much needed syntax highlighting, while we are editing scripts from within the IPython environment. Unfortunately, these magic '''alias''' functions do not save in between sessions when defined temporarily, this creates a problem since you would have to create them '''every time''' you start IPython. It will instead display an error message indicating that the alias command does not exist:<source>
exit
ipythonipython3
vim
</source> You should notice an error message indicating invalid syntax. This occurs since you need to create a config file to make this alias persist in-between sessions. You need to exit your ipython session in order to edit this configuration file.<br><br>
</source>
:#Save and exit the file. Now let's return to our IPython shell and confirm that our alias is available right away:<source>
ipythonipython3
vim
</source><br>At this point vim should open successfully and you should now understand how to create new IPython aliases and store them persistently. Use these aliases to customize your environment with any bash commands you thing IPython is missing.<br><br>
mkdir ~/ops435/lab8
</source>
:#If you are interested in finding more information about other magic functions in IPython, then within the IPython shell, and enter the following(press the letter '''q''' to exit this function):<source>
magic
</source>
<li style="margin-left:25px;">Make notes for observations in your lab log book, and proceed to investigation 3.</li></ol>
<br><br>
 
= INVESTIGATION 3: WRITING PYTHON SCRIPTS =
13,420
edits

Navigation menu