Book Image

Python for Finance

By : Yuxing Yan
Book Image

Python for Finance

By: Yuxing Yan

Overview of this book

Table of Contents (20 chapters)
Python for Finance
About the Author
About the Reviewers

Adding our project directory to the path

In the previous discussion, we assumed that all our programs are saved under our default directory, that is, Python33 in C: or other similar directories. Obviously, it is not convenient if we plan to save our Python programs for a specific project under our designated directory. Assume that all of our programs related to our investment courses are located at C:\yan\Teaching\Python_for_Finance\codes_chapters\. To include it in our path, we have the following Python code:

import sys
if myFolder not in sys.path:

To double check, we use the print(sys.path) command, as shown in the following code:

>>>import sys
['', 'C:\\Python33\\Lib\\idlelib', 'C:\\windows\\system32\\', 'C:\\Python33\\DLLs', 'C:\\Python33\\lib', 'C:\\Python33', 'C:\\Python33\\lib\\site-packages', 'C:\\Yan\\Teaching\\Python_for_Finance...