Compare commits
3 Commits
53fedd495e
...
41c8a603ed
| Author | SHA1 | Date | |
|---|---|---|---|
| 41c8a603ed | |||
| b19224a29b | |||
| 8ebd97cb08 |
23
my_movies/database.py
Normal file
23
my_movies/database.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import sqlite3, os
|
||||
|
||||
class db_work:
|
||||
def __init__(self,db_file = str ) -> None:
|
||||
self.db_file = db_file
|
||||
def create_db(self):
|
||||
with sqlite3.connect(self.db_file) as con_db:
|
||||
cursor = con_db.cursor()
|
||||
sql_code = '''
|
||||
CREATE TABLE IF NOT EXISTS eggs(
|
||||
cooler_typ TEXT,
|
||||
glückszahl INTEGER
|
||||
);
|
||||
'''
|
||||
cursor.execute(sql_code)
|
||||
con_db.commit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
script_folder = os.path.dirname(os.path.realpath(__file__))
|
||||
db_file_full = script_folder + os.sep + "spam.db"
|
||||
my_db = db_work(db_file=db_file_full)
|
||||
my_db.create_db()
|
||||
BIN
my_movies/spam.db
Normal file
BIN
my_movies/spam.db
Normal file
Binary file not shown.
9
test_skripte/comp_lampda_map.py
Normal file
9
test_skripte/comp_lampda_map.py
Normal file
@@ -0,0 +1,9 @@
|
||||
i = [2, 4, 6, 8 , 10 ]
|
||||
|
||||
# List comprehension
|
||||
test = [x * 2 for x in i]
|
||||
# lampda function
|
||||
lam_test = list(map(lambda x: x * 3, i))
|
||||
print(i)
|
||||
print(test)
|
||||
print(lam_test)
|
||||
@@ -1,7 +1,31 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
import os, sys
|
||||
import os, sys, pprint
|
||||
|
||||
|
||||
class show_system_info:
|
||||
def __init__(self, os_release_file = str) -> None:
|
||||
self.release_file = os_release_file
|
||||
|
||||
def os_release(self):
|
||||
my_discts = {}
|
||||
with open(self.release_file, "r") as file:
|
||||
lines = list(map(str.rstrip, file))
|
||||
for line in lines:
|
||||
date = line.split("=")
|
||||
my_discts[date[0]] = date[1]
|
||||
return my_discts
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(show_system_info.os_release(self))
|
||||
|
||||
|
||||
if not os.path.exists(os.sep + "home" + os.sep + os.environ["USER"]) is True:
|
||||
print("yes")
|
||||
print("yes")
|
||||
|
||||
|
||||
|
||||
|
||||
system_info = show_system_info(os_release_file="/etc/os-release")
|
||||
print(system_info)
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@ def replace_from(input = str):
|
||||
|
||||
print(replace_from(input="test dk"))
|
||||
|
||||
|
||||
|
||||
test = ["test 0", "test 2", "test 3" ]
|
||||
#map verfendet eine funktion auf eine Liste an
|
||||
splitting_map = map(len, test)
|
||||
|
||||
Reference in New Issue
Block a user