Most viewed questions in Python

0 votes
1 answer

How to create a dictionary whose elements are lists?

A simple way to do this is ...READ MORE

Aug 7, 2019 in Python by Arvind
• 3,040 points
852 views
0 votes
1 answer

Python constructors and __init__

There is no function overloading in Python, ...READ MORE

Oct 11, 2018 in Python by SDeb
• 13,300 points
852 views
0 votes
1 answer

Python using basicConfig method to log to console and file

I can't reproduce it on Python 3.3. ...READ MORE

Aug 14, 2018 in Python by aryya
• 7,450 points
850 views
0 votes
1 answer

Replacements for switch statement in Python?

To get the same function as a ...READ MORE

Feb 16, 2023 in Python by Rishu
• 300 points
849 views
0 votes
1 answer

How to rename column in pandas?

You can use the rename option to ...READ MORE

Apr 3, 2019 in Python by Firoz
849 views
0 votes
1 answer

python code for fall detection of a video file

Hello @Aruna, You can refer this for your ...READ MORE

Dec 2, 2020 in Python by Niroj
• 82,880 points
848 views
0 votes
0 answers

avro schema validation with shuffled columns

I want to validate my incoming Avro ...READ MORE

Aug 22, 2020 in Python by khyati
• 190 points
846 views
0 votes
1 answer

How to get domain name of email ID?

You can use the split method to split the ...READ MORE

Mar 28, 2019 in Python by Firoz
846 views
0 votes
1 answer

Which is the best IDE for Python For Windows

Python is dynamic language so the IDE ...READ MORE

Oct 10, 2018 in Python by Priyaj
• 58,090 points
846 views
0 votes
1 answer

How to transfer multiple lines in a file using python?

Hi@akhtar, I don't know it will help you ...READ MORE

Mar 31, 2020 in Python by MD
• 95,440 points
845 views
0 votes
1 answer

How can I read numbers in Python from a custom file?

Hi, good question. Let us first assume that ...READ MORE

Feb 6, 2019 in Python by Nymeria
• 3,560 points
845 views
0 votes
2 answers

How to add a certain time delay to the code using Python?

You can use time.sleep(duration in second) READ MORE

Feb 14, 2019 in Python by Shashank
• 1,370 points
844 views
0 votes
1 answer

How to remove a file using the OS module in Python?

Hi@akhtar, In Python, you can use the os. remove() method to remove ...READ MORE

Oct 18, 2020 in Python by MD
• 95,440 points
843 views
0 votes
1 answer

Embed R code in python

You can try this : from rpy import ...READ MORE

Feb 11, 2019 in Python by SDeb
• 13,300 points
841 views
0 votes
1 answer

How to print only the line which starts with P?

Hi, you might have found another way ...READ MORE

Dec 2, 2020 in Python by Tyler
• 140 points
839 views
0 votes
1 answer

Undefined Behaviour in Python

Python evaluates expressions from left to right. ...READ MORE

Jul 15, 2019 in Python by SDeb
• 13,300 points
839 views
0 votes
1 answer

Using filter, map, and reduce in Python

A quick implementation might look like this: from ...READ MORE

Nov 2, 2018 in Python by Priyaj
• 58,090 points
839 views
0 votes
1 answer

When to use %r instead of %s in Python? [duplicate]

The %s specifier converts the object using ...READ MORE

Aug 2, 2018 in Python by bug_seeker
• 15,520 points
838 views
0 votes
1 answer

Error:Warning:config file server.conf not found

Hello @kartik, By default, informational and debugging messages ...READ MORE

Jun 22, 2020 in Python by Niroj
• 82,880 points
836 views
0 votes
1 answer

Install Python on Ubuntu

@Abha you are right about pre-installation of python, ...READ MORE

Mar 1, 2019 in Python by Pratibha
• 3,690 points
836 views
0 votes
1 answer

Reading powershell clixml in python

PowerShell's Extended Type System supports auxiliary properties ...READ MORE

Sep 21, 2018 in Python by charlie_brown
• 7,720 points
836 views
0 votes
1 answer

Python code to send an email message from my gmail to many others

Hey @Varsha, you can try out the ...READ MORE

Jun 11, 2019 in Python by Travis
834 views
0 votes
2 answers

How to define a class in python?

Class use the special word  class for declaration. ...READ MORE

Jun 6, 2020 in Python by anonymous
• 580 points
833 views
+2 votes
1 answer

How can I record the X,Y limits of a displayed X,Y plot using the matplotlib show() module?

A couple hours after posting this question ...READ MORE

Dec 27, 2018 in Python by anonymous
833 views
0 votes
2 answers

Unable to use print statement in python3

print will work when you use print("Your ...READ MORE

Feb 14, 2019 in Python by Shashank
• 1,370 points
833 views
0 votes
1 answer

How to allow users to change their own passwords in Django?

Hello @kartik, See the Changing passwords section Navigation to your project ...READ MORE

Aug 17, 2020 in Python by Niroj
• 82,880 points
832 views
0 votes
1 answer

heapify returns NoneType

The heapify() method transforms the list in-place. This means ...READ MORE

Jul 26, 2019 in Python by SDeb
• 13,300 points
832 views
0 votes
1 answer

Python Regex Search And Replace

You need not use a regex. Your ...READ MORE

May 20, 2019 in Python by SDeb
• 13,300 points
832 views
0 votes
2 answers

Clear Screen in Python

pip3 install clear-screen and then: from clear_screen import clea ...READ MORE

Jan 28, 2019 in Python by Zong
832 views
0 votes
1 answer

Error like “Your CPU not supported AVX , AVX2”

Your CPU is supported, Only the Binary was ...READ MORE

Oct 14, 2020 in Python by anonymous
• 65,910 points
831 views
0 votes
0 answers

Visualize the full chess board from the library python-chess on line command

I am working a chess game based ...READ MORE

Nov 22, 2022 in Python by sarit
• 1,830 points
830 views
0 votes
1 answer

I'm working on a Summer dataset for practice in Python. However I get the below error:

Hi@Pratap, I think to find duplicate values using ...READ MORE

Jun 15, 2020 in Python by MD
• 95,440 points
828 views
0 votes
1 answer

how to plot a boxplot in python using seaborn?

following is the syntax for a boxplot ...READ MORE

Aug 13, 2019 in Python by Mohammad
• 3,230 points
827 views
0 votes
1 answer

How to import a module given its name as string?

With Python older than 2.7/3.1, that's pretty ...READ MORE

Nov 25, 2020 in Python by Gitika
• 65,910 points
826 views
0 votes
1 answer

Web scraping problem

This is because many websites do not ...READ MORE

Jul 31, 2019 in Python by Wajiha
• 1,950 points
824 views
0 votes
1 answer

How can I get list of values from dict?

Here is an example to get the ...READ MORE

Feb 14, 2022 in Python by Nandini
• 5,480 points
822 views
0 votes
1 answer

How to filter Pandas DataFrame by values of columns?

Hi@akhtar, You can filter Pandas Dataframe with the ...READ MORE

Oct 20, 2020 in Python by MD
• 95,440 points
822 views
0 votes
0 answers

Uploading JSON file to a new column in DynamoDB table.

Actually I have two dynamo db tables ...READ MORE

Mar 6, 2020 in Python by Naveena
822 views
0 votes
1 answer

I have trained a model using machine learning algorithm in python , now i want to create a browser extension of that saved model , Is it possible ??

Hi@Shubham, It may possible. When you saved your ML ...READ MORE

Jun 13, 2020 in Python by MD
• 95,440 points
819 views
0 votes
1 answer

Is there a way to run Python on Android?

YES! An example via Matt Cutts via SL4A -- "here’s ...READ MORE

Sep 19, 2018 in Python by Priyaj
• 58,090 points
819 views
0 votes
1 answer

How do I check if a list is empty in python?

Hey @Vedant, that's pretty simple and straightforward: if ...READ MORE

May 28, 2019 in Python by Karthik
818 views
0 votes
1 answer

How do I convert type of an array in python?

Use the following command to change the ...READ MORE

May 24, 2019 in Python by Kishore
818 views
0 votes
1 answer

How can I build a recursive function in python?

I'm wondering whether you meant "recursive". Here ...READ MORE

Sep 19, 2018 in Python by Priyaj
• 58,090 points
818 views
0 votes
1 answer

Doubt in numpy.vstack

The vstack function in numpy will stack ...READ MORE

Jul 30, 2019 in Python by Esha
817 views
0 votes
1 answer

How do I clone a Django model instance object and save it to the database?

Hello @kartik, Just change the primary key of ...READ MORE

Jun 26, 2020 in Python by Niroj
• 82,880 points
816 views
0 votes
1 answer

What is the logic to check if a number is prime or not in python?

n = int (input ('ENTER NUMBER TO ...READ MORE

Jul 16, 2020 in Python by amrut
• 240 points
816 views
0 votes
0 answers

How to input matrix (2D list) in Python?

I am working on a code that ...READ MORE

May 24, 2022 in Python by Kichu
• 19,050 points
814 views
0 votes
1 answer

How to remove blank spaces from Python string?

You can use the strip method to do ...READ MORE

Apr 4, 2019 in Python by Rishi
814 views
0 votes
1 answer

I've been trying to run this code, but the error says "Expected an indented block" for the line, " word_as_list[index] = guess."

Hi, @Paradox, The error message IndentationError: expected an indented ...READ MORE

Nov 21, 2020 in Python by anonymous
• 65,910 points
813 views
0 votes
1 answer

Python script if-else statement doubt

The reason for this is that the else loop ...READ MORE

May 23, 2019 in Python by Rajan
813 views