Most viewed questions in Python

0 votes
2 answers

How to check whether a string contains alphabets or number in Python?

By using isAlpha () to check whether ...READ MORE

Jul 14, 2019 in Python by Sheik janibasha
5,024 views
0 votes
1 answer

Can’t import TensorFlow. Could not find a version that satisfies the requirement TensorFlow

Basically, a solution would be to install ...READ MORE

Oct 15, 2020 in Python by anonymous
• 65,910 points
4,999 views
0 votes
1 answer

ModuleNotFoundError: No module named 'pyperclip

Hi@akhtar, You may get this error if this ...READ MORE

Jun 23, 2020 in Python by MD
• 95,440 points
4,999 views
0 votes
1 answer

How to get all links and all elements that are clickable on a page of system dynamically?

Hello, You can do it by using find_elements_by_xpath() driver ...READ MORE

Aug 27, 2020 in Python by Niroj
• 82,880 points
4,978 views
0 votes
1 answer

How to use HashMap in Python?

You can use Python dictionary it is a built-in type ...READ MORE

Oct 26, 2018 in Python by Priyaj
• 58,090 points
4,964 views
0 votes
2 answers

how can i randomly select items from a list?

You can also use the random library's ...READ MORE

Apr 9, 2020 in Python by Patrick
4,957 views
0 votes
1 answer

how to check the syntax of python program without running the program?

Yes, it is possible to check the ...READ MORE

Jun 27, 2019 in Python by Arvind
• 3,040 points
4,956 views
0 votes
2 answers

ImportError: No system module 'pywintypes' (pywintypes38.dll)

I just copied the DLL pywintypes27.dll in C:\Python27\Lib\site-packages\pywin32_system32. I added it ...READ MORE

Nov 25, 2020 in Python by Roshni
• 10,520 points
4,933 views
+2 votes
1 answer

How to install pip in windows?

Step 1:  Open the following link and go to ...READ MORE

Nov 27, 2018 in Python by Priyaj
• 58,090 points
4,908 views
0 votes
1 answer

Python error "ImportError: No module named SpeechRecognition"

Hi @Hannah, replace  import SpeechRecognition as sr with import speech_recognition ...READ MORE

Oct 3, 2019 in Python by Yamini
4,890 views
0 votes
1 answer

How to call a function from another file in Python?

Hi@akhtar, You can use the import keyword to ...READ MORE

Jun 24, 2020 in Python by MD
• 95,440 points
4,886 views
0 votes
1 answer

How to catch multiple exceptions in one line in python?

From Python Documentation: An except clause may name multiple ...READ MORE

Dec 17, 2020 in Python by Gitika
• 65,910 points
4,870 views
0 votes
1 answer

How to resize image canvas to maintain square aspect ratio in Python, OpenCv

Building on Alexander-Reynolds answer above, here is ...READ MORE

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

How do I install a Python package with a .whl file?

I just used the following which was ...READ MORE

Nov 20, 2020 in Python by Gitika
• 65,910 points
4,841 views
0 votes
1 answer

Error installing BeautifulSoup

You can use a simple command to ...READ MORE

Feb 14, 2019 in Python by Omkar
• 69,230 points
4,837 views
0 votes
1 answer

How can i import json file and encrypt it by using ASE MODE CBC encryption ?

Hi @Ahmed. Here's a sample code that ...READ MORE

Aug 20, 2019 in Python by Simran
4,836 views
0 votes
1 answer

How to print all the index of Pandas Dataframe?

Try this: print(df.index.values) READ MORE

Apr 8, 2019 in Python by Yogi
4,812 views
0 votes
1 answer

How do I make one turtle follow another turtle in python?

Try something like this: from turtle import Turtle, ...READ MORE

Jul 8, 2019 in Python by Ayushi
4,799 views
0 votes
1 answer

Error:Invalid http_host header

Hello @kartik, The error log is straightforward. As ...READ MORE

Jun 30, 2020 in Python by Niroj
• 82,880 points
4,787 views
+1 vote
1 answer

Django model iterate fields

You can try the following: getattr(foo.__class__, <field_name>)   This should ...READ MORE

Apr 10, 2019 in Python by SDeb
• 13,300 points
4,778 views
0 votes
1 answer

How to create Pytest report in html format?

Hi@akhtar, You can create a Pytest report in ...READ MORE

Jun 24, 2020 in Python by MD
• 95,440 points
4,768 views
0 votes
1 answer

Error: (2_0.W001) has a route that contains '(?P<', begins with a '^', or ends with a '$'

Hello @kartik, The new path() syntax in Django 2.0 does ...READ MORE

Jul 2, 2020 in Python by Niroj
• 82,880 points
4,766 views
0 votes
1 answer

How do I update pip itself from inside my virtual environment?

Hello, pip is just a PyPI package like any other; you ...READ MORE

Nov 20, 2020 in Python by Niroj
• 82,880 points
4,743 views
0 votes
1 answer

How to read an excel file (name User defined) from a path using python?

Hi @There, As the path is fixed, use ...READ MORE

Aug 13, 2020 in Python by Gitika
• 65,910 points
4,735 views
0 votes
1 answer

How to Filter for empty or NULL names in a queryset?

Hello @kartik, You could do this: Name.objects.exclude(alias__isnull=True) If you need ...READ MORE

Aug 6, 2020 in Python by Niroj
• 82,880 points
4,729 views
–1 vote
1 answer

Python program that calculates and prints value according to formula

Try this: import math c = 50 h = 30 value ...READ MORE

Jan 8, 2019 in Python by Omkar
• 69,230 points
4,726 views
0 votes
1 answer
0 votes
1 answer

Does Python's time.time() return the local or UTC timestamp?

The time.time() function returns the number of seconds since ...READ MORE

Nov 14, 2018 in Python by charlie_brown
• 7,720 points
4,717 views
+1 vote
1 answer

What's the difference between eval, exec, and compile in Python?

exec is not an expression: a statement ...READ MORE

Aug 28, 2018 in Python by Priyaj
• 58,090 points
4,715 views
0 votes
1 answer

Plot a k-distance graph in python

You probably want to use the matrix ...READ MORE

Sep 5, 2018 in Python by Priyaj
• 58,090 points
4,710 views
0 votes
1 answer

Return a list inside a for loop while iterating over the elements of another list

The print() is getting called multiple times ...READ MORE

Sep 22, 2018 in Python by SDeb
• 13,300 points
4,709 views
0 votes
1 answer

Error when running pip install: python setup.py egg_info"

ERROR: Command errored out with exit status ...READ MORE

Oct 29, 2020 in Python by anonymous
4,708 views
+2 votes
2 answers

How can I plot a k-dsitance graph using python?

Hi there, instead of sklearn you could ...READ MORE

Apr 10, 2018 in Python by charlie_brown
• 7,720 points
4,706 views
0 votes
1 answer

How to split a string to array in Python?

This way you can split your string ...READ MORE

Mar 4, 2019 in Python by Priyaj
• 58,090 points
4,698 views
0 votes
1 answer

Shift all indices in NumPy array

You can use the following : y = ...READ MORE

Feb 26, 2019 in Python by SDeb
• 13,300 points
4,697 views
0 votes
1 answer

How to add python console in spyder

(Spyder developer here) The Python console was ...READ MORE

Sep 18, 2018 in Python by Priyaj
• 58,090 points
4,694 views
0 votes
1 answer

How to count the number of elements in a list?

To count the number of elements of ...READ MORE

May 27, 2019 in Python by Nisa
• 1,090 points
4,672 views
0 votes
1 answer

How to extract specific tags in multiple html .txt files using python.

Hello, @Pooja, Even I got the same issue, ...READ MORE

Aug 5, 2020 in Python by Kedaar Thomas
4,666 views
0 votes
1 answer

Pandas series with custom index

You can do it by specifying index. ...READ MORE

Apr 1, 2019 in Python by Isha
4,647 views
0 votes
1 answer

how to get the volume size in docker-py?

When you created one volume in docker ...READ MORE

Apr 8, 2020 in Python by MD
• 95,440 points
4,634 views
0 votes
2 answers

Check a number is Prime or not in Python

There is an efficient way to write ...READ MORE

Oct 26, 2018 in Python by Priyaj
• 58,090 points
4,633 views
0 votes
1 answer

Is it possible to invert a Numpy boolean array in Python using the tilde operator (~)?

Good question, glad you brought this up. I ...READ MORE

Jan 11, 2019 in Python by Nymeria
• 3,560 points
4,632 views
0 votes
1 answer

No module name scikitplot

To overcome this issue, you need to ...READ MORE

Mar 9, 2019 in Python by Siri
4,625 views
0 votes
1 answer

Run python script on terminal (ubuntu)?

Your shell in the terminal has a concept ...READ MORE

Oct 31, 2018 in Python by Priyaj
• 58,090 points
4,618 views
0 votes
0 answers

How to read data using popen?

I have written below code and its ...READ MORE

Aug 19, 2019 in Python by anonymous
4,613 views
0 votes
1 answer

Need help extracting a schema to make use for an avro file in Python

Hi, nice question. So what I daily use ...READ MORE

Jan 10, 2019 in Python by Nymeria
• 3,560 points
4,610 views
0 votes
1 answer

How do you configure Django to send mail through Postfix?

You can do this by adding  settings.py ...READ MORE

Feb 25, 2019 in Python by SDeb
• 13,300 points
4,608 views
+1 vote
1 answer

How do I return JSON without using a template in Django?

Hello @kartik, In the case of the JSON ...READ MORE

Jul 3, 2020 in Python by Niroj
• 82,880 points
4,594 views
0 votes
2 answers

What is random.sample() method in Python?

The use of random.sample() Randomly select multiple items from ...READ MORE

Mar 13, 2020 in Python by Vishal
• 180 points
4,591 views
0 votes
1 answer

ModuleNotFoundError: No module named 'tools.nnwrap'

Hi@akhtar, I think you didn't install the torch ...READ MORE

Jun 29, 2020 in Python by MD
• 95,440 points
4,588 views