Modulsuchpfad

In [1]:
import fibo
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-4105c89a6fa8> in <module>()
----> 1 import fibo

ImportError: No module named 'fibo'
In [2]:
!ls
Grundlagen	  __pycache__	testvontestmodul.py  verwende_rechne.py
Grundlagen.ipynb  rechne.py	Untitled.ipynb
m1.py		  testmodul.py	Vertiefung.ipynb
In [3]:
!ls Grundlagen
Beispiele aus dem Unterkapitel Grundlagen.ipynb  fibo.py  __pycache__
In [4]:
import sys
In [5]:
print(sys.path)
['', '/home/student/anaconda3/lib/python35.zip', '/home/student/anaconda3/lib/python3.5', '/home/student/anaconda3/lib/python3.5/plat-linux', '/home/student/anaconda3/lib/python3.5/lib-dynload', '/home/student/anaconda3/lib/python3.5/site-packages', '/home/student/anaconda3/lib/python3.5/site-packages/Sphinx-1.4.1-py3.5.egg', '/home/student/anaconda3/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg', '/home/student/anaconda3/lib/python3.5/site-packages/IPython/extensions', '/home/student/.ipython']
In [6]:
sys.path.append("./Grundlagen")
In [7]:
print(sys.path)
['', '/home/student/anaconda3/lib/python35.zip', '/home/student/anaconda3/lib/python3.5', '/home/student/anaconda3/lib/python3.5/plat-linux', '/home/student/anaconda3/lib/python3.5/lib-dynload', '/home/student/anaconda3/lib/python3.5/site-packages', '/home/student/anaconda3/lib/python3.5/site-packages/Sphinx-1.4.1-py3.5.egg', '/home/student/anaconda3/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg', '/home/student/anaconda3/lib/python3.5/site-packages/IPython/extensions', '/home/student/.ipython', './Grundlagen']
In [8]:
import fibo

Dir Funktion

In [9]:
dir(fibo)
Out[9]:
['__builtins__',
 '__cached__',
 '__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__spec__',
 'fib',
 'fib2']
In [10]:
fibo.fib(100)
1 1 2 3 5 8 13 21 34 55 89 
In [11]:
fibo.fib2(100)
Out[11]:
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
In [12]:
import math
dir(math)
Out[12]:
['__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__spec__',
 'acos',
 'acosh',
 'asin',
 'asinh',
 'atan',
 'atan2',
 'atanh',
 'ceil',
 'copysign',
 'cos',
 'cosh',
 'degrees',
 'e',
 'erf',
 'erfc',
 'exp',
 'expm1',
 'fabs',
 'factorial',
 'floor',
 'fmod',
 'frexp',
 'fsum',
 'gamma',
 'gcd',
 'hypot',
 'inf',
 'isclose',
 'isfinite',
 'isinf',
 'isnan',
 'ldexp',
 'lgamma',
 'log',
 'log10',
 'log1p',
 'log2',
 'modf',
 'nan',
 'pi',
 'pow',
 'radians',
 'sin',
 'sinh',
 'sqrt',
 'tan',
 'tanh',
 'trunc']