diff --git a/ReadMe.md b/ReadMe.md index 709afb6..97d34e8 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -5,6 +5,7 @@ ___ ## Installation `pip install plotly` +`pip install pandas` ## Dokumentation diff --git a/misc/simple_1.py b/misc/simple_1.py new file mode 100644 index 0000000..fa14df2 --- /dev/null +++ b/misc/simple_1.py @@ -0,0 +1,36 @@ +# Kommentar + +# Strings + +bla = 'das ist ein schöner Schdring\n \ + nächste Zeile' +print(bla) +print(bla[2:10]) # Substring +print(bla[:3] + bla[-6:]) # erstes und letztes Wort + +# List +werte = [ 3, 6, 23, 34, 56.3, 35.6] +print(werte) +werte.append(23) # returns none +print(werte) +werte[2] = 4 # mutable, with index +print(werte) + +# Fibonacci +a, b = 0, 1 # multiple assignment +while a < 10: + print(a, end=':') # Schleifenbody ist eingerückt + a, b = b, a + b + +print("\n -- Primzahlensuche:") + +# Primzahlensuche mit for .. else! +for n in range(2, 10): + for x in range(2, n): + if n % x == 0: + print(n, "equals", x, "*", n//x) + break + else: + # keinen Faktor gefunden (innere Schleife) + print(n, "ist Primzahl") + diff --git a/misc/simple_2.py b/misc/simple_2.py new file mode 100644 index 0000000..dd07f17 --- /dev/null +++ b/misc/simple_2.py @@ -0,0 +1,34 @@ +point = (3, 0) +match point: + case (0,0): + print("Origin") + case (0, y): + print(f"Y={y}") + case (x, 0): + print(f"X={x}") + case (x, y): + print(f"X={x}, Y={y}") + case _: + raise ValueError("no point") + + +def fib(n): + """Print a fibonacci series up to n.""" # this is the doc string + result = [] + a, b = 0, 1 + while a < n: + result.append(a) + a, b = b, a + b + return result + +print(fib(2000)) + +def Collector(a, L=[]): # L wird hier nur einmal initialisiert! + L.append(a) + return L + +print(Collector(2)) +print(Collector(58)) +print(Collector("Gurkensalat")) + + diff --git a/misc/werkzeug_test.py b/misc/werkzeug_test.py new file mode 100644 index 0000000..23ab40a --- /dev/null +++ b/misc/werkzeug_test.py @@ -0,0 +1,31 @@ +from contextlib import nullcontext +import imp +import os + +from venv import create +from werkzeug.test import create_environ +from werkzeug.serving import run_simple + +from werkzeug.urls import url_parse +from werkzeug.wrappers import Request, Response +from werkzeug.routing import Map, Rule +from werkzeug.exceptions import HTTPException, NotFound +from werkzeug.middleware.shared_data import SharedDataMiddleware +from werkzeug.utils import redirect + + + +#environ = create_environ('/bla', 'http://localhost:8999') +#environ['PATH_INFO'] + +class Device(object): + + def __init__(self, config): + pass + + def dispatch_request(self, request): + return Response('got it') + +app = Device(nullcontext) + +run_simple('heupferd', 8999, app, use_reloader=True) \ No newline at end of file diff --git a/misc/wifi.py b/misc/wifi.py new file mode 100644 index 0000000..0db3804 --- /dev/null +++ b/misc/wifi.py @@ -0,0 +1,11 @@ +#https://www.geeksforgeeks.org/how-to-find-available-wifi-networks-using-python/ + +import subprocess + +devices = subprocess.check_output(['netsh', 'wlan', 'show', 'network']) +devices = devices.decode('ascii') +devices = devices.replace("\r", "") + +print(devices) + +