Most answered questions in Python

0 votes
1 answer

How to access environment variable values?

Hello @kartik, To check if the key exists ...READ MORE

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

How do I pass a variable by reference?

Hello, Just wrap it in a list: def Change(self, ...READ MORE

Nov 18, 2020 in Python by Niroj
• 82,880 points
321 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,880 points
349 views
0 votes
1 answer

Error:AttributeError: 'NoneType' object has no attribute 'extend'

Hello @kartik, You can use itertools.chain(): import itertools list2d = [[1,2,3], ...READ MORE

Nov 18, 2020 in Python by Niroj
• 82,880 points
3,034 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,880 points
356 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,880 points
339 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,880 points
684 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,880 points
469 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,880 points
372 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,880 points
518 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
570 views
0 votes
1 answer

Creating a login page, when passing json values showing me error?<class 'NoneType'>???

#appriciate your helping email = input("enter your email ...READ MORE

Nov 17, 2020 in Python by rehan
• 160 points
1,076 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,910 points
474 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,910 points
436 views
0 votes
1 answer

The below code prints none at the end.

the code after return does not execute. ...READ MORE

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

ValueError: must have exactly one of create/read/write/append mode

You can open a file for simultaneous ...READ MORE

Nov 15, 2020 in Python by Gitika
• 65,910 points
3,160 views
0 votes
1 answer

While debugging in visual studio it runs but it doesn't show any error

You're sending infinitely increasing data. Maybe it's ...READ MORE

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

Error is '<' not supported between instances of str and int

your dis is obviously not 1.13, it's ...READ MORE

Nov 15, 2020 in Python by Gitika
• 65,910 points
5,313 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,910 points
485 views
0 votes
1 answer

How to enter this command “py -3 -m pip install -r requirements.txt”

Open cmd and type the command and ...READ MORE

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

How can I test if a string can be converted to another type dynamically?

You can use isinstance() function to check ...READ MORE

Nov 15, 2020 in Python by Gitika
• 65,910 points
302 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
454 views
0 votes
1 answer

Distance calculator

Hello @ Try this code: import math x, y = ...READ MORE

Nov 13, 2020 in Python by Niroj
• 82,880 points
3,355 views
0 votes
1 answer

TypeError: 'float' object cannot be interpreted as an integer

Hi, @There, The “TypeError: ‘float’ object cannot be ...READ MORE

Nov 13, 2020 in Python by Gitika
• 65,910 points
41,888 views
0 votes
1 answer

AttributeError: 'Group' object has no attribute 'user'

You can go through this: from django.contrib.auth.models import ...READ MORE

Nov 12, 2020 in Python by Gitika
• 65,910 points
3,074 views
0 votes
1 answer

How to implemented the custom user model?

Yes, pip install my plugin and check ...READ MORE

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

How to connect my app to mongo?

Most users try to use NoSQL-like DBs ...READ MORE

Nov 12, 2020 in Python by Gitika
• 65,910 points
310 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,910 points
426 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,910 points
504 views
0 votes
1 answer

How to insert value by one post method in 2 table with Django?

try  import-export   library of Django or if you are ...READ MORE

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

How to give local path instead of media URL?

If u are using iframe, you can ...READ MORE

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

How do I build a website with referral link on Django?

simple solution.. import hashlib Refferal(Model): user ...READ MORE

Nov 12, 2020 in Python by Gitika
• 65,910 points
2,171 views
0 votes
1 answer

Error in Django 2.1.5 Method Not Allowed

UpdateView only allows GET and POST... if ...READ MORE

Nov 12, 2020 in Python by Gitika
• 65,910 points
3,896 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,910 points
588 views
0 votes
1 answer

Unable to access UserProfile model fields in templates in Django.

Use {{ request.user.get_profile.whatever }}. Django's templating language ...READ MORE

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

what is the output of m = np.array([2,4,6]) n = np.array([2, True, False]) print(m+n)

Hi. @Nandini, The above code will give you ...READ MORE

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

How to divide one number to another multiple times, untill it will be about 0?

You can do something like this:  while num ...READ MORE

Nov 10, 2020 in Python by Gitika
• 65,910 points
2,467 views
0 votes
1 answer

what does this line fout.write("</{}>\n".format(opentags.pop())) do?

It closes one tag actually, opentags is ...READ MORE

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

How to see more rows in a dataframe?

You can go through the given below: pd.set_option('display.max_rows', ...READ MORE

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

How to install module in virtual environment?

The Python installers for Windows include pip. ...READ MORE

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

How to iterate a Json file which has multiple key value pairs and also nested list as part of the file?

I think you need to create some ...READ MORE

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

Support vector Regresson

Hi,@ Manoj, I would suggest you go through ...READ MORE

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

Is there anyway to get the total count of times of a Generator?

Generators are originally created to return an ...READ MORE

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

How to print error in web browser if there is error in code?

You can try to catch these errors ...READ MORE

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

ImportError: cannot import name 'API_KEY' from 'forwarder'

The AWS package in PyPI is not AWS's official ...READ MORE

Nov 6, 2020 in Python by Gitika
• 65,910 points
2,231 views
0 votes
1 answer

why is the dcount and tcount 0 and 0 in the output?

Because the dcount and tcount variables you ...READ MORE

Nov 6, 2020 in Python by Gitika
• 65,910 points
536 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,910 points
930 views
0 votes
1 answer

How to add properties while installing GOTO?

You can follow a few steps: click advanced ...READ MORE

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

How to install pip?

'pip' is not recognized as an internal ...READ MORE

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

How to avoid missing module docstring in pylint?

Either write your docs or use a ...READ MORE

Nov 6, 2020 in Python by anonymous
• 65,910 points
5,365 views