Community Questions

Join the discussion, find answers, and help others.

Ask Question
39 votes
1
answers
1524 views

How to handle keyboard interrupts in Python

My script should clean up when user presses Ctrl+C. How do I handle this?

C
cloud_arch asked 4 weeks, 1 day ago
47 votes
1
answers
1002 views

How to use Python multiprocessing for parallel tasks

My script is CPU-bound and slow. How can I use multiple cores?

Y
youssef_net asked 4 weeks, 1 day ago
37 votes
1
answers
263 views

How to send emails in Python

I need to send automated emails from my Python script. How do I do this?

D
db_admin asked 4 weeks, 1 day ago
45 votes
1
answers
1163 views

How to work with SQLite in Python

I need a simple database for my Python project. How do I use SQLite?

L
layla_web asked 4 weeks, 1 day ago
14 votes
1
answers
386 views

How to create and use Python decorators

I see @decorator syntax in Python. How do I create my own decorator?

N
noor_code asked 4 weeks, 1 day ago
6 votes
1
answers
743 views

How to download files in Python

What is the correct way to download files from URLs in Python?

W
web_developer asked 4 weeks, 1 day ago
13 votes
1
answers
822 views

How to parse XML in Python

I need to read and parse XML files in Python. What is the best approach?

L
layla_web asked 4 weeks, 1 day ago
23 votes
1
answers
230 views

How to use Python logging module properly

I want to replace print statements with proper logging. How do I set it up?

F
fatima_dev asked 4 weeks, 1 day ago
13 votes
1
answers
1860 views

How to create a class in Python

What is the proper way to define a class with methods and properties?

N
noor_code asked 4 weeks, 1 day ago
11 votes
1
answers
739 views

How to read CSV files in Python

What is the best way to read and process CSV files?

H
hassan_ops asked 4 weeks, 1 day ago
28 votes
1
answers
1429 views

How to format strings in Python

What are the different ways to format strings in Python?

D
devops_guru asked 4 weeks, 1 day ago
3 votes
1
answers
506 views

How to remove duplicates from a list in Python

I have a list with duplicate values. How do I remove them?

S
sysadmin asked 4 weeks, 1 day ago
33 votes
1
answers
518 views

How to check if file exists in Python

I need to check if a file or directory exists before processing it.

Y
youssef_net asked 4 weeks, 1 day ago
7 votes
1
answers
555 views

How to merge two dictionaries in Python

What is the cleanest way to combine two dictionaries?

W
web_developer asked 4 weeks, 1 day ago
30 votes
1
answers
1180 views

How to sort a list of dictionaries in Python

I have a list of dictionaries and want to sort by a specific key.

H
hassan_ops asked 4 weeks, 1 day ago
36 votes
1
answers
1698 views

How to iterate over dictionary in Python

What is the best way to loop through a dictionary keys and values?

S
security_pro asked 4 weeks, 1 day ago
12 votes
1
answers
844 views

How to create custom Django management commands

I need to create a custom command that I can run with manage.py. How do I create one?

P
python_dev asked 4 weeks, 1 day ago
35 votes
1
answers
335 views

How to use regular expressions in Python

I need to extract data from text using patterns. How do I use regex in Python?

N
noor_code asked 4 weeks, 1 day ago
36 votes
1
answers
1586 views

How to work with environment variables in Python

How do I read environment variables in Python and set default values if they do not exist?

L
linux_expert asked 4 weeks, 1 day ago
38 votes
1
answers
1257 views

How to use context managers (with statement) in Python

I see "with" statements used in Python. What are context managers and how do I create my own?

D
db_admin asked 4 weeks, 1 day ago
Page 1 of 2 Next