Trending questions in Python

0 votes
1 answer

How do I make a field readonly (or disabled) so that it cannot be edited in Django form?

Hello @kartik, Setting readonly on a widget only makes the ...READ MORE

Aug 6, 2020 in Python by Niroj
• 82,800 points
17,834 views
0 votes
0 answers

Write a program to find largest of three numbers entered by the user.

pls answer this right now pls pls READ MORE

Sep 14, 2021 in Python by op

edited Mar 4 298 views
0 votes
0 answers
0 votes
2 answers

How to call perl script in Python script?

If you just want to open a ...READ MORE

Oct 7, 2020 in Python by Reshma
14,823 views
0 votes
0 answers

How Can I pass a Django Date Range Search Result page by page using Paginator in views and template

I have written a Python Django Method ...READ MORE

Sep 9, 2021 in Python by SUCCESSGANDE

edited Mar 4 310 views
0 votes
1 answer

TypeError: list indices must be integers or slices, not str

Hi@akhtar, As we know that the index of ...READ MORE

Oct 15, 2020 in Python by MD
• 95,460 points
14,377 views
0 votes
1 answer

How to access a dictionary element in a Django template?

Hello @kartik, Use Dictionary Items: {% for key, value ...READ MORE

Jul 3, 2020 in Python by Niroj
• 82,800 points
18,752 views
0 votes
4 answers

Install Python3 on Mac

Prerequisites You will need a macOS computer with ...READ MORE

Dec 15, 2020 in Python by Roshni
• 10,440 points
20,727 views
0 votes
0 answers

DJANGO HELP NEEDED

Whenever I run Command (DJANGO-ADMIN) it gives ...READ MORE

Sep 3, 2021 in Python by Nabeel

edited Mar 4 319 views
0 votes
0 answers

Why showing This Error:- spiral.forward(i*10) IndentationError: expected an indented block

import turtle sc=turtle.Screen() sc.setup(600,600) spiral=turtle.Tu ...READ MORE

Sep 3, 2021 in Python by Pradip

edited Mar 4 305 views
0 votes
1 answer

Error:Django TemplateSyntaxError - 'staticfiles' is not a registered tag library

Hello @kartik, Try {% load static %} instead of {% load ...READ MORE

Jul 29, 2020 in Python by Niroj
• 82,800 points
17,497 views
0 votes
0 answers

IndentationError: expected an indented block, while executing elbow method

K = range(1,10) sum_sq_dst = [] for k in ...READ MORE

Sep 1, 2021 in Python by Edureka

edited Mar 4 230 views
0 votes
2 answers

How can I write a program to add two numbers using functions in python?

there is sum() function as a built ...READ MORE

Oct 25, 2020 in Python by anonymous
24,768 views
+1 vote
1 answer

Error:__init__() got an unexpected keyword argument 'user'

Hello @kartik, You can't do LivingRoom.objects.create(user=instance) because you have an __init__ method ...READ MORE

Jun 30, 2020 in Python by Niroj
• 82,800 points
18,398 views
0 votes
2 answers

ModuleNotFoundError: No module named 'apyori'

apriori is python 2.7 module so this ...READ MORE

Jun 9, 2020 in Python by sahil
• 500 points
19,230 views
0 votes
0 answers

[Errno 11001] getaddrinfo failed

I am getting the error : [Errno 11001] ...READ MORE

Aug 20, 2021 in Python by RICHA
• 140 points

edited Mar 4 372 views
0 votes
1 answer

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte

Hi, @hala, Regarding your query, you can go ...READ MORE

Jun 29, 2020 in Python by Niroj
• 82,800 points
18,456 views
0 votes
0 answers
0 votes
1 answer

ModuleNotFoundError: No module named 'nltk'

Hi@akhtar, It seems this module is not present ...READ MORE

Jun 26, 2020 in Python by MD
• 95,460 points
18,205 views
0 votes
1 answer

ValueError: could not broadcast input array from shape (360,270,3) into shape (360,280,3)

Hi@akhtar, In the above error it shows could not ...READ MORE

Apr 9, 2020 in Python by MD
• 95,460 points
21,359 views
0 votes
1 answer

What will be the output of below code and why? x=[1,2,3,4,5] print(x.insert(2,3))

x=1, x=2, x=3, x=4, x=5 READ MORE

Sep 28, 2021 in Python by Harsh yadav

edited Mar 5 5,604 views
0 votes
0 answers

I tried to import turtle and I tried to write sc = turtle.Screen() but it gives attribute error in these.

import turtle    # make screen object # and set ...READ MORE

Aug 6, 2021 in Python by anonymous

edited Mar 4 322 views
0 votes
1 answer

'utf-8' codec can't decode byte 0x82 in position 16: invalid start byte

Hi@zena, The error is because there is some non-ASCII ...READ MORE

Jun 29, 2020 in Python by MD
• 95,460 points
17,666 views
0 votes
1 answer

How to load python script in Jupyter Notebook?

Hi@akhtar, Starting from IPython 3 (now Jupyter project), ...READ MORE

Aug 17, 2020 in Python by MD
• 95,460 points
15,506 views
0 votes
2 answers

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

R u getting the issue while running ...READ MORE

Nov 2, 2020 in Python by anonymous
12,282 views
0 votes
0 answers

I have the following python script. I keep getting "AxisError" at the # First Derivative in time.

# Creating Features Space features = {} # Raw ...READ MORE

Aug 3, 2021 in Python by Edureka

edited Mar 4 334 views
0 votes
2 answers

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 16: invalid start byte

Thanks, This answer was helpful. READ MORE

Jul 11, 2020 in Python by Prashant Chhatrashali
19,005 views
+1 vote
2 answers

Python error "ZeroDivisionError: float division by zero"

The error is thrown in this line matchPercentage ...READ MORE

May 21, 2020 in Python by Prabhakar
23,928 views
0 votes
1 answer

Why can't Python parse this JSON data?

Your data is not a valid JSON format. You ...READ MORE

Dec 20, 2020 in Python by Reshma
9,772 views
+1 vote
1 answer

Error:Pandas read_csv low_memory and dtype options

Hello @kartik, Try this: dashboard_df = pd.read_csv(p_file, sep=',', error_bad_lines=False, ...READ MORE

Jun 22, 2020 in Python by Niroj
• 82,800 points
17,401 views
0 votes
0 answers

How can I fix the attribute error in my pycharm IDE?

Traceback (most recent call last):   File "C:\Users\SONY\PycharmProjects\Python Tuts\.idea\chammach.py", ...READ MORE

Jul 25, 2021 in Python by anonymous

edited Mar 4 268 views
0 votes
1 answer

gaierror: [Errno 11003] getaddrinfo failed

Hi@akhtar, It most likely means the hostname of ...READ MORE

Apr 15, 2020 in Python by MD
• 95,460 points
20,320 views
0 votes
0 answers

how should i get rid of the error, so my codes runs?

ValueError: invalid literal for int() with base ...READ MORE

Jul 24, 2021 in Python by anonymous

edited Mar 4 270 views
+1 vote
5 answers

Tkinter error: tkinter.TclError: bad geometry specifier

You have to use the character ‘x’ ...READ MORE

May 9, 2019 in Python by Tina
22,148 views
0 votes
0 answers
0 votes
1 answer

How to Install pip for python 3.7 on Ubuntu 18?

The command you're looking for is: python3.7 -m ...READ MORE

Nov 20, 2020 in Python by Gitika
• 65,730 points
10,428 views
0 votes
1 answer

How to get Request.User in Django-Rest-Framework serializer?

Hello @kartik, You cannot access the request.user directly. You need ...READ MORE

Aug 12, 2020 in Python by Niroj
• 82,800 points
14,688 views
0 votes
0 answers

Hello. I'm trying to convert this string '0x278a51da' into a integer so I can use it on the ctime() from time.

time_in_hexa_format_as_string = '0x278a51da' def get_time_stamp(value_for_time): ...READ MORE

Jul 12, 2021 in Python by Rafael

edited Mar 4 269 views
+1 vote
1 answer

module 'numpy' has no attribute 'unit8'

Hi@akhtar, You have used unit8 in your code. ...READ MORE

Jun 23, 2020 in Python by MD
• 95,460 points
16,779 views
0 votes
0 answers

Type() function in Python

.I know that type() function is used ...READ MORE

Jul 10, 2021 in Python by Brijesh
• 120 points

edited Mar 4 313 views
0 votes
1 answer

How to use Django variable in JavaScript file?

Hello @kartik, You need to print it before ...READ MORE

Jul 29, 2020 in Python by Niroj
• 82,800 points
15,214 views
0 votes
1 answer

How to change a Django form field to a hidden field?

Hello @kartik, If you have a custom template ...READ MORE

Jul 29, 2020 in Python by Niroj
• 82,800 points
15,190 views
0 votes
0 answers

python: how to print the data frame columns with out index and also left indent

Hi There, Basically I want to read a ...READ MORE

Jul 9, 2021 in Python by balaji

edited Mar 4 331 views
0 votes
1 answer

How to PATCH a single field using Django Rest Framework?

Hello @kartik, Serializers allow partial updates by specifying partial=True when initializing ...READ MORE

Jun 25, 2020 in Python by Niroj
• 82,800 points
16,556 views
0 votes
0 answers

TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Hi guys i have below code . ...READ MORE

Oct 30, 2019 in Python by sumanth
• 190 points
12,581 views
0 votes
1 answer

Error:No module named MySQLdb

Hii @kartik, Try this code: pip install PyMySQL and then ...READ MORE

Jun 26, 2020 in Python by Niroj
• 82,800 points
16,375 views
0 votes
2 answers

How do I convert text file to CSV file with only plain python. Meaning no panda or any other special module?

Steps to Convert Text File to CSV ...READ MORE

Oct 15, 2020 in Python by Abdul Shekh
11,505 views
0 votes
1 answer

How to add multiple columns to pandas dataframe in one assignment?

Hello @kartik, You could use assign with a dict of ...READ MORE

Jun 15, 2020 in Python by Niroj
• 82,800 points
16,800 views
+1 vote
1 answer

How to create a file and save it to a model's FileField in Django?

Hello @kartik, Basically, a field declared as a FileField, ...READ MORE

Jun 30, 2020 in Python by Niroj
• 82,800 points
16,086 views