FREYR BATTERY Forum: Community User: Mountainclimber
Eigentlich ein Unding und nicht ansatzweise Nachvollziehbar. Keine Ahnung warum die Ersteller dieser Seite dies nicht einfügen. Nun denn, anhand von Phyton hat mir ChatGPT eine Blockier Beispiel Programmierung erstellt, woran sich die Betreiber dieses Forums ja mal inspirieren lassen können. Sowas zu implementieren dauert wie lange ? 5 min ??? : # Annahme: Sie verwenden Python und eine SQLite-Datenbank # Imports import sqlite3 # Verbindung zur Datenbank herstellen conn = sqlite3.connect('forum.db') cursor = conn.cursor() # Datenbank-Tabelle erstellen, um Blockierungen zu speichern cursor.execute(''' CREATE TABLE IF NOT EXISTS blocklist ( user_id INTEGER, blocked_user_id INTEGER, PRIMARY KEY (user_id, blocked_user_id) ) ''') # Funktion zum Blockieren eines Benutzers def block_user(user_id, blocked_user_id): cursor.execute('INSERT INTO blocklist (user_id, blocked_user_id) VALUES (?, ?)', (user_id, blocked_user_id)) conn.commit() # Funktion zum Überprüfen, ob ein Benutzer blockiert ist def is_user_blocked(user_id, blocked_user_id): cursor.execute('SELECT COUNT(*) FROM blocklist WHERE user_id = ? AND blocked_user_id = ?', (user_id, blocked_user_id)) result = cursor.fetchone() return result[0] > 0 # Beispielverwendung user_id = 1 blocked_user_id = 2 block_user(user_id, blocked_user_id) if is_user_blocked(user_id, blocked_user_id): print('Der Benutzer {} ist blockiert.'.format(blocked_user_id)) else: print('Der Benutzer {} ist nicht blockiert.'.format(blocked_user_id)) # Verbindung zur Datenbank schließen conn.close()
Mehr zu diesem Wert
|
|
Thema | ||
|---|---|---|---|
| 1 | DAX Hauptdiskussion | +1,69 % | |
| 2 | Dax Prognose | +1,69 % | |
| 3 | UBISOFT Hauptdiskussion | -8,56 % | |
| 4 | NVIDIA Hauptdiskussion | +2,16 % | |
| 5 | RHEINMETALL Hauptdiskussion | +2,57 % | |
| 6 | Beyond Meat Hauptdiskussion | +4,29 % | |
| 7 | TUI Hauptforum | +2,50 % | |
| 8 | ROHÖL WTI Hauptdiskussion | -5,40 % | |
| 9 | Goldpreis Hauptdiskussion | +1,14 % | |
| 10 | DRONESHIELD LTD Hauptdiskussion | -4,39 % | Alle Diskussionen |
|
|
Thema | ||
|---|---|---|---|
| 1 | UBISOFT Hauptdiskussion | -8,56 % | |
| 2 | NVIDIA Hauptdiskussion | +1,85 % | |
| 3 | RHEINMETALL Hauptdiskussion | +2,57 % | |
| 4 | Beyond Meat Hauptdiskussion | +3,65 % | |
| 5 | TUI Hauptforum | +2,21 % | |
| 6 | DRONESHIELD LTD Hauptdiskussion | -4,39 % | |
| 7 | VONOVIA Hauptdiskussion | +2,42 % | |
| 8 | FREYR Battery Inc Registered Shs Hauptdiskussion | +30,82 % | |
| 9 | BLOOM ENERGY A Hauptdiskussion | +10,41 % | |
| 10 | AFC ENERGY Hauptdiskussion | -2,10 % | Alle Diskussionen |