Most voted questions in Python

0 votes
3 answers

How do I use raw_input in Python 3?

raw_input() was renamed to input() in Python 3. Another example ...READ MORE

Jan 4, 2021 in Python by Carlos
2,780 views
0 votes
1 answer

Is it possible to break a long line to multiple lines in Python?

Example of implicit line continuation: a = some_function( ...READ MORE

Jan 4, 2021 in Python by Gitika
• 65,910 points
1,022 views
0 votes
3 answers

How to add a new item to a dictionary in Python?

There is no add() , append() , or insert() method ...READ MORE

Jan 4, 2021 in Python by Reshma
590 views
0 votes
3 answers

TypeError: 'module' object is not callable

Solve By Calling with Module Name Another solution to the TypeError: 'module' object ...READ MORE

Jan 4, 2021 in Python by Carlos
34,671 views
0 votes
2 answers

How do I set the figure title and axes labels font size in Matplotlib?

Setting the font size of the figure ...READ MORE

Jan 4, 2021 in Python by Nikita
7,844 views
0 votes
2 answers

How to change the font size on a matplotlib plot?

Functions dealing with text like label, title, etc. accept ...READ MORE

Jan 4, 2021 in Python by Carlos
3,822 views
0 votes
2 answers

How do I make python wait for a pressed key?

Then use this code: import keyboard keyboard.sleep() READ MORE

Jan 4, 2021 in Python by Reshma
75,563 views
0 votes
2 answers

Deleting DataFrame row in Pandas based on column value

Pandas provide data analysts a way to ...READ MORE

Jan 4, 2021 in Python by Nikita
2,085 views
0 votes
0 answers

joining two images reading from one folder

Hi, i am trying to generating joined ...READ MORE

Jan 3, 2021 in Python by shapna
• 120 points
540 views
0 votes
0 answers

how to fix the ERROR: Could not find a version that satisfies the requirement engine

when I install engine or anyother module ...READ MORE

Jan 3, 2021 in Python by Muhammad Ali
• 120 points
1,710 views
0 votes
1 answer

Error in jarvis project (get url)

Hey, @Zodarlxx, Could you please post your error ...READ MORE

Dec 30, 2020 in Python by Gitika
• 65,910 points
545 views
0 votes
1 answer

How to ignore Headers in S3 bucket CSV file using python?

Hi@durgaraju, You can fetch only the body part. ...READ MORE

Dec 29, 2020 in Python by MD
• 95,440 points
1,907 views
0 votes
3 answers

How can I sort a dictionary by key in python?

Another way could be: color_dict = {'red':'#FF0000',           'green':'#008000',           'black':'#000000',           'white':'#FFFFFF'} for ...READ MORE

Dec 28, 2020 in Python by Thomas Walenta
849 views
0 votes
2 answers

How do I check if a variable exists in python?

Python doesn’t have a specific function to ...READ MORE

Dec 28, 2020 in Python by Carlos
11,947 views
0 votes
3 answers

How do I find the location of my Python site-packages directory?

Configuring Python to use additional locations for ...READ MORE

Dec 28, 2020 in Python by Nikita
88,051 views
0 votes
3 answers

Best way to convert string to bytes in Python?

We can use the built-in Bytes class in Python ...READ MORE

Dec 28, 2020 in Python by David Samon
30,027 views
0 votes
3 answers

Count the number occurrences of a character in a string

The string count() method returns the number of occurrences of ...READ MORE

Dec 28, 2020 in Python by Carlos
13,430 views
0 votes
3 answers

Is there a simple way to delete a list element by value?

There are three ways in which you ...READ MORE

Dec 28, 2020 in Python by Thomas Walenta
515 views
0 votes
1 answer

Running shell command and capturing the output

Modern versions of Python (3.5 or higher): run If ...READ MORE

Dec 28, 2020 in Python by Gitika
• 65,910 points
2,557 views
0 votes
2 answers

what path should I give to the url for showing a pop up when clicking on "more info" button in django?

I think u can use the bootstrap ...READ MORE

Dec 29, 2020 in Python by Carlos
2,999 views
0 votes
1 answer

Hey Does anybody know how to fix the unexpected indent error?

Hello, @Aarohan, As the error message indicates, you ...READ MORE

Dec 28, 2020 in Python by Gitika
• 65,910 points
432 views
0 votes
1 answer
0 votes
0 answers

I can't get accurate value in dictionaries in django

Whenever I try to print the dictionaries ...READ MORE

Dec 25, 2020 in Python by Mohamed
• 170 points
355 views
0 votes
1 answer

For Professional window GUI develepoment which python lib/module/framework is best?

HI, @Ganesh, Tkinter is one of the most ...READ MORE

Dec 24, 2020 in Python by Gitika
• 65,910 points
407 views
0 votes
1 answer

Getting error "AttributeError: 'Screen' object has no attribute 'title' on line 8"

Hey @TedTickles,  Replace  wn.update() with turtle.up ...READ MORE

Dec 24, 2020 in Python by Gitika
• 65,910 points
3,504 views
0 votes
1 answer

How to read a text file into a string variable and strip newlines?

You could use: with open('data.txt', 'r') as file: ...READ MORE

Dec 23, 2020 in Python by Gitika
• 65,910 points
451 views
0 votes
1 answer

Adding new column to existing DataFrame in Python pandas

Use the original df1 indexes to create ...READ MORE

Dec 23, 2020 in Python by Gitika
• 65,910 points
1,166 views
0 votes
1 answer

if/else in a list comprehension

You can totally do that. It's just ...READ MORE

Dec 23, 2020 in Python by Gitika
• 65,910 points
3,972 views
0 votes
1 answer

How to get list from pandas DataFrame column headers?

You can get the values as a ...READ MORE

Dec 23, 2020 in Python by Gitika
• 65,910 points
758 views
0 votes
1 answer

how can I save my output of xml parsing in excel file...?

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

Dec 23, 2020 in Python by Gitika
• 65,910 points
381 views
0 votes
1 answer

please what does print_details do in python?

Hi, @There, The print() function prints the specified message to the ...READ MORE

Dec 23, 2020 in Python by Gitika
• 65,910 points
406 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
8,542 views
0 votes
1 answer

Delete column from pandas DataFrame in python

As you've guessed, the right syntax is del ...READ MORE

Dec 20, 2020 in Python by Gitika
• 65,910 points
764 views
0 votes
1 answer

Getting the class name of an instance?

Have you tried the __name__ attribute of the class? ie type(x).__name__ will ...READ MORE

Dec 20, 2020 in Python by Gitika
• 65,910 points
360 views
0 votes
1 answer

How to pad zeroes to a string?

Strings: >>> n = '4' >>> print(n.zfill(3)) 004 And for numbers: >>> ...READ MORE

Dec 20, 2020 in Python by Gitika
• 65,910 points
405 views
0 votes
1 answer

Importing files from different folder in python.

By default, you can't. When importing a ...READ MORE

Dec 20, 2020 in Python by Nikita
3,570 views
0 votes
1 answer

How do you append to a file in Python?

with open("test.txt", "a") as myfile: ...READ MORE

Dec 20, 2020 in Python by Gitika
• 65,910 points
502 views
0 votes
1 answer

Exception in Tkinter callback Traceback (most recent call last):

Hello, @R, As per the Beautiful Soup Documentation: AttributeError: 'NoneType' ...READ MORE

Dec 21, 2020 in Python by Gitika
• 65,910 points
19,337 views
0 votes
1 answer

Meaning of @classmethod and @staticmethod for beginner?

Example class Date(object): def __init__(self, ...READ MORE

Dec 18, 2020 in Python by Gitika
• 65,910 points
418 views
0 votes
1 answer

How can I count the occurrences of a list item?

If you only want one item's count, ...READ MORE

Dec 18, 2020 in Python by Gitika
• 65,910 points
495 views
0 votes
1 answer

How to remove an element from a list by index?

Use del and specify the index of the element ...READ MORE

Dec 18, 2020 in Python by Gitika
• 65,910 points
575 views
0 votes
1 answer

How can I print literal curly-brace characters in python string and also use .format on it?

You need to double the {{ and }}: >>> x = ...READ MORE

Dec 18, 2020 in Python by Gitika
• 65,910 points
463 views
0 votes
1 answer

How can I remove a trailing newline?

Try the method rstrip() (see doc Python 2 and Python 3) >>> 'test ...READ MORE

Dec 18, 2020 in Python by Gitika
• 65,910 points
654 views
0 votes
1 answer

Why is reading lines from stdin much slower in C++ than Python?

tl;dr: Because of different default settings in ...READ MORE

Dec 18, 2020 in Python by Nikita
1,015 views
0 votes
1 answer

HI Mr / Mrs I have problem with my jupiter notebook when i try to learn Your video about Machine Learning. Can You help me please ?

Hi@Herlambang, I think you have a 32-bit system. ...READ MORE

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

How to print colored text in Python?

This somewhat depends on what platform you ...READ MORE

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

How to delete a file or folder?

os.remove() removes a file. os.rmdir() removes an empty directory. shutil.rmtree() deletes a ...READ MORE

Dec 17, 2020 in Python by Nikita
375 views
0 votes
1 answer

How to find current directory and file's directory?

To get the full path to the ...READ MORE

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

“Least Astonishment” and the Mutable Default Argument

Actually, this is not a design flaw, ...READ MORE

Dec 17, 2020 in Python by Gitika
• 65,910 points
336 views
0 votes
0 answers

The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I couldn't figure out the problem. here my ...READ MORE

Dec 17, 2020 in Python by muammer
• 120 points
7,349 views