Fatima Al-Rashid
@fatima_dev
About
Python developer and data scientist
Q&A Statistics
All Answers
Re: How to work with SQLite in Python
import sqlite3 # Connect to database conn = sqlite3.connect('database.db') cursor = conn.cursor() # Create table cursor.execute(''' CREATE TABLE IF NOT …
Re: How to parse XML in Python
import xml.etree.ElementTree as ET # Parse XML file tree = ET.parse('data.xml') root = tree.getroot() # Parse XML string root = …
Re: How to create Django forms
from django import forms from .models import Article # Regular Form class ContactForm(forms.Form): name = forms.CharField(max_length=100) email = forms.EmailField() message …
Re: How to remove duplicates from a list in Python
my_list = [1, 2, 2, 3, 3, 3, 4] # Convert to set (loses order) unique = list(set(my_list)) # Preserve …
Re: CORS errors in Django REST API - complete fix
CORS issues are common in API development. Here's the complete solution: Install django-cors-headers pip install django-cors-headers Configure settings.py INSTALLED_APPS = …