Trending questions in Python

0 votes
1 answer

How can I get a list of locally installed Python modules?

Do not use with pip > 10.0! My ...READ MORE

Nov 26, 2020 in Python by anonymous
• 65,770 points
582 views
0 votes
0 answers

NameError: name 'genomic_dna_4' is not defined

I use python for biology and I got ...READ MORE

Nov 10, 2020 in Python by skylar
• 120 points
1,307 views
0 votes
1 answer

How to convert bytes to a string?

You need to decode the bytes object ...READ MORE

Nov 26, 2020 in Python by Gitika
• 65,770 points
576 views
0 votes
1 answer

Python: TypeError :Cannot cast Index to dtype int

Try to use numpy  and use .astype(np,int) ...READ MORE

Jun 25, 2020 in Python by Sirajul
• 59,230 points
7,236 views
0 votes
1 answer

How can I install pip on Windows?

Python 2.7.9+ and 3.4+ Python 3.4 (released March 2014) ...READ MORE

Nov 22, 2020 in Python by Gitika
• 65,770 points
745 views
0 votes
1 answer

Does Python have a string 'contains' substring method?

You can use the in operator: if "blah" not in ...READ MORE

Nov 26, 2020 in Python by Gitika
• 65,770 points
569 views
0 votes
1 answer

How to generate all permutations of a list?

Hello @kartik, Try this: def permutations(head, tail=''): ...READ MORE

Nov 17, 2020 in Python by Niroj
• 82,840 points
955 views
0 votes
1 answer

Django: Display a custom error message for admin validation error

Hello @kartik, Without looking, it sounds like the ...READ MORE

Jun 12, 2020 in Python by Niroj
• 82,840 points
7,767 views
0 votes
1 answer

How to print prime numbers from 1 to n?

Hello @divyashree def isPrime(n): # ...READ MORE

Oct 13, 2020 in Python by Niroj
• 82,840 points
2,473 views
0 votes
0 answers
0 votes
1 answer

How do you use a variable in a regular expression?

Instead of using the /regex/g syntax, you can construct ...READ MORE

Nov 26, 2020 in Python by Gitika
• 65,770 points
519 views
0 votes
1 answer

Which is the best Python web framework for beginners?

Go for Django . It's easy and ...READ MORE

Nov 18, 2020 in Python by Jayant Kumar
892 views
0 votes
1 answer

How can I safely create a nested directory?

On Python ≥ 3.5, use pathlib.Path.mkdir: from pathlib import ...READ MORE

Nov 25, 2020 in Python by Gitika
• 65,770 points
577 views
0 votes
0 answers

hello guys i need help to make this code run plz !

H= float (input("Is this circuit charging& ...READ MORE

Nov 25, 2020 in Python by anonymous
• 120 points
596 views
0 votes
1 answer

How can I do not equal in Django queryset filtering?

Hello @kartik, You can use Q objects for this. They ...READ MORE

Nov 17, 2020 in Python by Niroj
• 82,840 points
872 views
0 votes
1 answer

Error:Reverse accessor for 'Analysis.assign_user' clashes with reverse accessor for 'Inquiry.assign_user'.

Hello @kartik, The related_name would ensure that the fields were ...READ MORE

Jun 30, 2020 in Python by Niroj
• 82,840 points
6,913 views
0 votes
1 answer

How to get the current time in Python?

Use: >>> import datetime >>> datetime.datetime.now() datetime.datetime(2009, 1, 6, 15, ...READ MORE

Nov 20, 2020 in Python by Gitika
• 65,770 points
712 views
0 votes
1 answer

How to overcome “datetime.datetime not JSON serializable”?

Hii @kartik, The simple solution to over come ...READ MORE

Jun 5, 2020 in Python by Niroj
• 82,840 points
7,973 views
0 votes
1 answer

ModuleNotFoundError: No module named 'pyttsx3' || "Running setup.py install for comtypes ... error" error when installing pyttsx3

Hello, @There It depends on which version of ...READ MORE

Oct 7, 2020 in Python by Gitika
• 65,770 points
2,601 views
0 votes
1 answer

Can't import scikit -learn on python3.

Hi@akhtar, First, remove the Sklearn form your Windows system ...READ MORE

Jun 23, 2020 in Python by MD
• 95,460 points
7,146 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,840 points
5,217 views
0 votes
1 answer

How are Python metaclasses different from regular class inheritance?

Python 3 class MyClass(object): = New-style class class MyClass: = New-style ...READ MORE

Nov 20, 2020 in Python by Gitika
• 65,770 points
628 views
0 votes
1 answer

urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>

Hi@akhtar, You need to use the read function in ...READ MORE

Jul 15, 2020 in Python by MD
• 95,460 points
6,163 views
0 votes
1 answer

How do I get the number of elements in a list?

Hello, The len() function can be used with several different ...READ MORE

Nov 18, 2020 in Python by Niroj
• 82,840 points
712 views
0 votes
1 answer

ImportError: No module named mpmath. But mpmath has been installed.

You should use conda to install Python ...READ MORE

Nov 4, 2020 in Python by Gitika
• 65,770 points
1,335 views
0 votes
1 answer

How to read a HDF file with Pandas?

Hi@akhtar, You can read an HDF file using ...READ MORE

Oct 18, 2020 in Python by MD
• 95,460 points
2,064 views
0 votes
1 answer

AssertionError: <class 'numpy.ndarray'>

Hi, @There, The traceback module and sys.exc_info are ...READ MORE

Oct 19, 2020 in Python by anonymous
• 65,770 points
1,977 views
0 votes
1 answer

How can I create a nested directory?

Hello, Using try except and the right error ...READ MORE

Nov 18, 2020 in Python by Niroj
• 82,840 points
649 views
0 votes
1 answer

Error: Can't import matplotlib library.

Install the older version of python, I also ...READ MORE

Nov 6, 2020 in Python by Gitika
• 65,770 points
1,168 views
0 votes
1 answer

Why not inherit from List<T>?

There are some good answers here. I ...READ MORE

Nov 20, 2020 in Python by Gitika
• 65,770 points
573 views
0 votes
1 answer

How to call an external command?

Look at the subprocess module in the standard library: import ...READ MORE

Nov 19, 2020 in Python by Gitika
• 65,770 points
640 views
0 votes
1 answer

How to run code when a class is subclassed?

Classes (by default) are instances of the ...READ MORE

Nov 20, 2020 in Python by Gitika
• 65,770 points
566 views
0 votes
1 answer

How to concatenate items in a list to a single string?

Hello @kartik, Use join: >>> sentence = ['this','is','a','sentence'] >>> '-'.join(sentence) 'this-is-a-sentence' Hope it ...READ MORE

Nov 17, 2020 in Python by Niroj
• 82,840 points
654 views
0 votes
1 answer

how to send post request to a webpage using cookies and headers in python to scrape the webpage ?

Hey @Avinash, Regarding your query, I would suggest ...READ MORE

Sep 29, 2020 in Python by Roshni
• 10,480 points
2,776 views
0 votes
1 answer

Why do we not follow the "off by one" rule in python

It's because of the way in which ...READ MORE

Nov 15, 2020 in Python by Gitika
• 65,770 points
729 views
0 votes
1 answer

How to call an external command?

Hello @kartik, Look at the subprocess module in the standard ...READ MORE

Nov 18, 2020 in Python by Niroj
• 82,840 points
586 views
0 votes
1 answer

How do I parse XML in Python?

Hello @kartik, You can use BeautifulSoup: from bs4 import BeautifulSoup x="""<foo> ...READ MORE

Nov 19, 2020 in Python by Niroj
• 82,840 points
551 views
0 votes
1 answer

Deployed Django project on heroku But I don't know which database is it using. Is there a way to know that So that I can login to admin page?

If you don't configure one you might ...READ MORE

Nov 12, 2020 in Python by anonymous
• 65,770 points
826 views
0 votes
1 answer

How do I list all files of a directory?

Hii, Try this: import os os.listdir("somedirectory") Thank you!! ...READ MORE

Nov 18, 2020 in Python by Niroj
• 82,840 points
554 views
0 votes
1 answer

Error:Pip install: can't open file pip, or Parent module '' not loaded

Hello @kartik, Assuming you have pip installed and ...READ MORE

Jul 3, 2020 in Python by Niroj
• 82,840 points
6,549 views
0 votes
0 answers

How to get output result from selecting two dropdown menu options in tkinter?

if i choose a value from first ...READ MORE

Sep 4, 2020 in Python by Charitra
• 120 points
3,836 views
0 votes
1 answer

Unable to create a project in django.

I think u didn't install Django. python -m ...READ MORE

Nov 12, 2020 in Python by Gitika
• 65,770 points
796 views
0 votes
2 answers

module 'numpy' has no attribute 'unit8'

Hi@Ganesh, I think you are calling the wrong ...READ MORE

Sep 22, 2020 in Python by MD
• 95,460 points
2,949 views
+1 vote
1 answer

How to install django in anaconda prompt?

Here are the steps that you can ...READ MORE

Jun 23, 2020 in Python by Sirajul
• 59,230 points
6,849 views
0 votes
1 answer

How to generate a string token using four of this items random?

One approach just generates random integers up ...READ MORE

Nov 16, 2020 in Python by Gitika
• 65,770 points
620 views
0 votes
1 answer

How to check permission inside a template in Django?

Hello @kartik, To check for permissions in templates, ...READ MORE

Aug 7, 2020 in Python by Niroj
• 82,840 points
4,940 views
0 votes
1 answer

How to test multiple variables against a value?

Hello @kartik, Your problem is more easily addressed ...READ MORE

Nov 17, 2020 in Python by Niroj
• 82,840 points
528 views
0 votes
1 answer

Error: showing database is locked

ah, sqlite3 stuff... remove .session file and ...READ MORE

Nov 15, 2020 in Python by Sheema
613 views
0 votes
1 answer

Tried setting up Django-shop on my system, but when I try to run pipenv install , I get this:404 Snippet not found

Uninstall all python first then install python ...READ MORE

Nov 12, 2020 in Python by Gitika
• 65,770 points
739 views
0 votes
1 answer

Sigma code look like this but it’s not working.

Use Markdown to style code: - Use a ...READ MORE

Nov 15, 2020 in Python by Gitika
• 65,770 points
604 views