Trending questions in Python

0 votes
1 answer

How to import other Python files?

Just import file without the '.py' extension. You can mark ...READ MORE

Nov 26, 2020 in Python by Gitika
• 65,770 points
1,230 views
0 votes
2 answers

Python error "TypeError: Can't convert 'int' object to str implicitly"

A TypeError can occur if the type ...READ MORE

Feb 5, 2020 in Python by lovelmark
• 160 points
1 flag 19,340 views
0 votes
1 answer

I am making a ai in python but there is a error

Hi, @Rhydham, Try this: engine = pyttsx3.init('dummy') If you want ...READ MORE

Oct 12, 2020 in Python by Gitika
• 65,770 points

edited Aug 11, 2021 by Soumya 3,228 views
0 votes
1 answer

I installed windows 10 through vmware workstation . I want to connect remote machine using python winrm im getting error

Hey, @Natraj, This basically means that no response ...READ MORE

Dec 2, 2020 in Python by Gitika
• 65,770 points
946 views
0 votes
4 answers

How to print instances of a class using print()?

You need to implement your own __repr__ ...READ MORE

Nov 25, 2020 in Python by Saksham Azad
1,221 views
+1 vote
1 answer
0 votes
1 answer

What is the difference between Python's list methods append and extend?

Appends object at the end. x = [1, ...READ MORE

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

i am getting an error on pycharm while installing packages

Hi, @There, $ pip install gevent --pre $ pip ...READ MORE

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

How to print an exception in Python?

Hello @kartik, For Python 2.6 and later and ...READ MORE

Dec 7, 2020 in Python by Niroj
• 82,840 points
652 views
0 votes
1 answer

How do I create a constant in Python?

Hello @kartik, No there is not. You cannot ...READ MORE

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

How to make a password validator without the use of the any()?

Hi, @There, Regarding your query I would suggest ...READ MORE

Dec 8, 2020 in Python by Gitika
• 65,770 points
624 views
0 votes
1 answer

How do I detect whether a Python variable is a function?

Hello @kartik, You can import isfunction from the inspect module. >>> from inspect ...READ MORE

Dec 7, 2020 in Python by Niroj
• 82,840 points
617 views
0 votes
1 answer

python pycharm is not proper working

Hi, @Webinar, Are you getting any kind of ...READ MORE

Dec 14, 2020 in Python by Gitika
• 65,770 points
375 views
0 votes
1 answer

Error is "invalid literal for int() with base 10: ' ' "

This error is caused because we try ...READ MORE

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

How do I check if a string is a number (float)?

I'm not sure that anything much could ...READ MORE

Dec 2, 2020 in Python by Gitika
• 65,770 points
811 views
0 votes
1 answer

What is the difference between an abstract function and a virtual function?

An abstract function cannot have functionality. You're basically ...READ MORE

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

Why is it string.join(list) instead of list.join(string)?

It's because any iterable can be joined ...READ MORE

Dec 2, 2020 in Python by Gitika
• 65,770 points
802 views
0 votes
1 answer

There are some Error so resolve quickly

Hi@Aditya, It is working fine in my python ...READ MORE

Dec 9, 2020 in Python by MD
• 95,460 points
510 views
0 votes
1 answer

Importing modules from parent folder

It seems that the problem is not ...READ MORE

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

How to check if type of a variable is string?

Hello @kartik, You can do: var = 1 if type(var) ...READ MORE

Dec 7, 2020 in Python by Niroj
• 82,840 points
553 views
0 votes
1 answer

IndentationError: expected an indented block

Hello @ nishit, Indentation means the space from margin to ...READ MORE

Aug 10, 2020 in Python by Niroj
• 82,840 points
5,770 views
0 votes
1 answer

How to randomly select an item from a list?

Use random.choice() import random foo = ['a', 'b', 'c', 'd', ...READ MORE

Dec 2, 2020 in Python by Gitika
• 65,770 points
746 views
0 votes
2 answers

Is Python fully object oriented?

Python supports all the concept of "object ...READ MORE

Sep 13, 2020 in Python by Anjali Chauhan
18,333 views
0 votes
1 answer

What is the easiest way to remove all packages installed by pip?

I've found this snippet as an alternative ...READ MORE

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

Could you please help to write a code for this program

Hello, @Hitesh, You can follow the below: print("List of ...READ MORE

Nov 4, 2020 in Python by Roshni
• 10,480 points
1,956 views
0 votes
1 answer

How do I copy a file in Python?

from shutil import copyfile copyfile(src, dst) Copy the contents ...READ MORE

Dec 7, 2020 in Python by Gitika
• 65,770 points
553 views
0 votes
0 answers

AttributeError: 'numpy.int32' object has no attribute 'map'

can any one suggest solution data['isLarge'] = data.size.map({'small' ...READ MORE

Sep 5, 2020 in Python by Mohammed
• 120 points
4,580 views
0 votes
1 answer

Webscraping error using your code

Hi, @Shrinidhi, Kindly share your code snippet with ...READ MORE

Dec 2, 2020 in Python by Gitika
• 65,770 points
732 views
0 votes
1 answer

How to return None if Dictionary key is not available

Hello @kartik, You can use dict.get() value = d.get(key) which will ...READ MORE

Apr 30, 2020 in Python by Niroj
• 82,840 points
10,054 views
0 votes
1 answer

How do I copy a file in Python?

from shutil import copyfile copyfile(src, dst) Copy the ...READ MORE

Dec 7, 2020 in Python by Gitika
• 65,770 points
537 views
0 votes
1 answer

my Py Audio is not Downloading what should I do

Hello @S.P.D, First try to check your python ...READ MORE

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

How to convert doc file into pdf using python?

A simple example using com types, converting ...READ MORE

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

What is the difference between an interface and abstract class?

Interfaces An interface is a contract: The person writing ...READ MORE

Nov 30, 2020 in Python by Gitika
• 65,770 points
789 views
0 votes
0 answers

convert dictionary in python

can you please help me on this. ...READ MORE

Dec 10, 2020 in Python by Edureka
• 120 points
399 views
0 votes
1 answer

How to import a module given its name as string?

With Python older than 2.7/3.1, that's pretty ...READ MORE

Nov 25, 2020 in Python by Gitika
• 65,770 points
1,018 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 7, 2020 in Python by Gitika
• 65,770 points
473 views
0 votes
1 answer

How to make function decorators and chain them together?

Here is what you asked for: from functools ...READ MORE

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

Python error "TypeError: string indices must be integers, not str"

Hey @Dipti email_s.append(email_1["email_address"]) This is the list on ...READ MORE

Jul 5, 2019 in Python by Jinu
22,944 views
0 votes
1 answer

Difference between __str__ and __repr__?

The default implementation is useless (it’s hard ...READ MORE

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

How to convert integer to string in Python?

if You Want to convert int to ...READ MORE

Nov 28, 2020 in Python by Rohan
• 200 points
778 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,272 views
0 votes
1 answer

Check if a given key already exists in a dictionary?

in is the intended way to test for ...READ MORE

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

How to access the user profile in a Django template?

Hello @kartik, In your profile model provide related_name user ...READ MORE

Jul 29, 2020 in Python by Niroj
• 82,840 points
6,054 views
0 votes
1 answer

How to replace all occurrences of a string?

The general pattern is str.split(search).join(replacement) This used to be ...READ MORE

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

How do I concatenate two lists in Python?

You can use the + operator to combine them: listone ...READ MORE

Dec 3, 2020 in Python by anonymous
• 65,770 points
546 views
0 votes
1 answer

Why does DEBUG=False setting make my django Static Files Access fail?

Hello @kartik, If you still need to server ...READ MORE

Aug 6, 2020 in Python by Niroj
• 82,840 points
5,690 views
0 votes
1 answer

How to find all occurrences of a substring?

There is no simple built-in string function ...READ MORE

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

I am trying to install os-win on my python 3.8. But I end up with the following error:

I have the same issue and is ...READ MORE

Sep 6, 2020 in Python by anonymous
7,915 views
0 votes
1 answer

How to know if an object has an attribute in Python?

Try hasattr(): if hasattr(a, 'property'): a.property The ...READ MORE

Dec 2, 2020 in Python by Gitika
• 65,770 points
570 views
0 votes
1 answer

I've been trying to run this code, but the error says "Expected an indented block" for the line, " word_as_list[index] = guess."

Hi, @Paradox, The error message IndentationError: expected an indented ...READ MORE

Nov 21, 2020 in Python by anonymous
• 65,770 points
1,083 views