[go: up one dir, main page]

0% found this document useful (0 votes)
41 views1 page

Lecture Storing Functions

python

Uploaded by

gromlive
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views1 page

Lecture Storing Functions

python

Uploaded by

gromlive
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Tip: Storing a Function

Note that in the lectures I am just typing and executing code interactively in the iPython
console. I am not saving your code. I am just testing.

In later lectures I will start writing code inside a Python script as I build a Python program
that reads CSV data, processes them and generates a KML file that can be viewed in Google
Earth. So, we have to save that script as a file somewhere in our computer.

However, if you are impatient and would like to experiment with storing functions in a
script already, here is a hint how to do it:

1. In Spyder, go to View Panes and make sure the Editor is checked.


2. Write the function in the editor
3. Save it somewhere in your computer by going to File Save.
4. Run the script so that Python reads your code using the green triangle icon or hit F5
from the keyboard.
5. Then, simply call the function in the iPython console as shown in the screenshot.

You can also write the function call line in the script after the function block if you like.

You might also like