Most viewed questions in Python

0 votes
1 answer

ImportError: openpyxl is required for loading excel format files

Forget the PsychoPy complications for the time ...READ MORE

Oct 3, 2018 in Python by Priyaj
• 58,090 points
813 views
0 votes
1 answer

Iterating over dictionaries using 'for' loops

key is just a variable name. for key ...READ MORE

Oct 8, 2018 in Python by SDeb
• 13,300 points
812 views
0 votes
1 answer

Polynomials in Python

You can easily find polynomials of any ...READ MORE

Aug 27, 2019 in Python by Wajiha
• 1,950 points
811 views
0 votes
1 answer

Why Django modeltranslation too many feilds

You can use the below link to ...READ MORE

Oct 1, 2018 in Python by Priyaj
• 58,090 points
810 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
809 views
0 votes
1 answer

How can I print an Error in Python?

For Python 2.6 and later and Python ...READ MORE

Oct 12, 2018 in Python by aryya
• 7,450 points
809 views
0 votes
0 answers

how to deploy bluk python yamls on kubernetes using jinja template

1.how to deploy  python  services yamls  or ...READ MORE

Mar 19, 2019 in Python by devops learner
808 views
+1 vote
1 answer

Implement Quicksort in Python

This will help you. def sort(array=[2,5,1,6,9,8,7,10,21,12]): ...READ MORE

Oct 30, 2018 in Python by Priyaj
• 58,090 points
807 views
0 votes
1 answer

Azure VM Monitoring

Hi, @Mukund, For an Azure Virtual Machine, we ...READ MORE

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

Python: nested 'for' loops

Could use itertools: >>> for comb in itertools.combinations_with_replacement(range(9, -1, ...READ MORE

Sep 3, 2018 in Python by Priyaj
• 58,090 points
803 views
0 votes
1 answer

How to make a chain of function decorators?

Hello @kartik, Python decorators add extra functionality to ...READ MORE

Apr 13, 2020 in Python by Niroj
• 82,880 points
802 views
0 votes
2 answers

argparse argument order

Using Pisa will serve your needs.. READ MORE

Feb 28, 2019 in Python by Pratosh kumar
801 views
0 votes
1 answer

How to add to the python path in Windows?

You know what has worked for me ...READ MORE

Jul 25, 2018 in Python by Frankie
• 9,830 points
799 views
0 votes
1 answer

Does Python's time.time() return the local or UTC timestamp?

The time.time() function returns the number of seconds since ...READ MORE

Oct 5, 2018 in Python by SDeb
• 13,300 points
798 views
0 votes
1 answer

Python ctypes segmentation fault when rootfs is read-only and /tmp is noexec

I cant really seem to reproduce the ...READ MORE

Aug 28, 2018 in Python by anonymous
796 views
0 votes
1 answer

Shuffling a Word

You can try the following: import random word = ...READ MORE

Jan 30, 2019 in Python by SDeb
• 13,300 points
795 views
0 votes
1 answer

What is the use of “assert” keyword in Python?

You can try the following in a ...READ MORE

Oct 15, 2018 in Python by Priyaj
• 58,090 points
795 views
+1 vote
1 answer

Error in git and python command

The answer to your first problem is ...READ MORE

Jul 4, 2019 in Python by Simran
793 views
0 votes
1 answer

Remove a string suffix

You can remove the substring using slicing. ...READ MORE

Jun 7, 2018 in Python by Hamartia's Mask
• 1,580 points
792 views
0 votes
1 answer

Size of an object in Python

Use sys.getsizeof() function: >>> import sys >>> s = ...READ MORE

May 25, 2018 in Python by Nietzsche's daemon
• 4,260 points
792 views
0 votes
0 answers

Flattening a list of NumPy arrays?

I have data in a list type ...READ MORE

Aug 5, 2022 in Python by krishna
• 2,820 points
789 views
0 votes
1 answer

What is a tuple in python?

A tuple is a collection data type ...READ MORE

May 21, 2019 in Python by Mohammad
• 3,230 points
787 views
0 votes
1 answer

Best way to avoid stale *.pyc files?

There is a useful environment variable for ...READ MORE

May 16, 2019 in Python by SDeb
• 13,300 points
785 views
0 votes
1 answer

What does calling a function means in Python?

Calling a function means that you are ...READ MORE

Dec 18, 2018 in Python by Shuvodip
784 views
0 votes
1 answer

Increment operators in Python

Python has no unary operators. So use ...READ MORE

May 12, 2018 in Python by Hamartia's Mask
• 1,580 points
784 views
0 votes
1 answer

How to debug in Django code?

Hello @kartik, There are a bunch of ways ...READ MORE

Aug 6, 2020 in Python by Niroj
• 82,880 points
783 views
0 votes
1 answer

position error

Hi, @There, The key error generally means the ...READ MORE

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

Print C format in Python

For printf- style formatting and special case ...READ MORE

Sep 18, 2018 in Python by SDeb
• 13,300 points
782 views
+1 vote
1 answer

What is the correct order to learn concepts in Python for machine learning?

Machine Learning is a vast domain. It ...READ MORE

Jul 25, 2018 in Python by Abhi
• 3,720 points
782 views
0 votes
1 answer

Can't Click an Element in Python Selenium After Successfully Finding It

I've encountered this problem of not being ...READ MORE

Oct 8, 2018 in Python by Priyaj
• 58,090 points
781 views
0 votes
1 answer

'python' is not recognized as an internal or external command

Use "py" instead of "python" from command ...READ MORE

Feb 16, 2022 in Python by CoolCoder
• 4,400 points
780 views
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,910 points
780 views
0 votes
1 answer

Why am I getting a error when I am printing two different data types in python?

different data type is being used. that ...READ MORE

Mar 6, 2019 in Python by Mohammad
• 3,230 points
780 views
0 votes
1 answer

What are good rules of thumb for Python imports?

I would normally use import X on module level. ...READ MORE

Nov 14, 2018 in Python by Nymeria
• 3,560 points

edited Dec 18, 2018 by Nymeria 780 views
0 votes
1 answer

How to get the position of a character in Python?

There are two string methods for this, find() and index(). ...READ MORE

Jan 5, 2021 in Python by Gitika
• 65,910 points
778 views
0 votes
1 answer

Generators with plots

Yes, you can. I tried doing it ...READ MORE

Jul 16, 2019 in Python by Wajiha
• 1,950 points
778 views
0 votes
1 answer

Difference between del, remove and pop on lists

es, remove removes the first matching value, ...READ MORE

Aug 1, 2018 in Python by Priyaj
• 58,090 points
778 views
0 votes
0 answers

Why does "pip install" inside Python raise a SyntaxError?

I wanted to use pip to install ...READ MORE

Apr 24, 2022 in Python by Kichu
• 19,050 points
777 views
0 votes
1 answer

ln (Natural Log) in Python

Use math.log it is a natural logarithm. For ...READ MORE

Apr 25, 2022 in Python by narikkadan
• 63,420 points
775 views
0 votes
1 answer

What are the arguments of sorted() function in Python?

Sorted() sorts any sequence (list, tuple) and ...READ MORE

Jul 29, 2019 in Python by Neel
• 3,020 points
775 views
0 votes
1 answer

how to convert a group of strings to integer?

a = ['1','2','3','4'] b = list(map(int,a)) print(b) this is how ...READ MORE

Mar 18, 2019 in Python by Mohammad
• 3,230 points
773 views
0 votes
1 answer

Install Python packages on Windows?

First, pip is preferred over easy_install.  Then follow these steps to ...READ MORE

Oct 29, 2018 in Python by Priyaj
• 58,090 points
773 views
0 votes
2 answers

Calling an external command in Python

import os os.system('external_command') Replace external_command in the above code ...READ MORE

Oct 16, 2018 in Python by Omkar
• 69,210 points
773 views
0 votes
1 answer

How to convert an integer to a string using Python?

Here is an easy solution: def numberToBase(n, b): ...READ MORE

Nov 23, 2018 in Python by Nymeria
• 3,560 points

edited Dec 12, 2018 by Nymeria 770 views
+1 vote
1 answer

How can I map input to output without using dynamic()

Here am talking about my example you ...READ MORE

Aug 8, 2018 in Python by Priyaj
• 58,090 points
769 views
0 votes
1 answer

Is there a foreach function in python and is there a way to implement it if there isnt any

Every occurence of "foreach" I've seen (PHP, ...READ MORE

Aug 31, 2018 in Python by charlie_brown
• 7,720 points
768 views
0 votes
1 answer

How to find all the tags in the page using BeautifulSoup?

Try this code: for tag in soup.find_all(True): ...READ MORE

Apr 2, 2019 in Python by Soumya
767 views
0 votes
1 answer

Python set Union and set Intersection operate differently?

When you do set() you are creating an empty ...READ MORE

May 24, 2018 in Python by charlie_brown
• 7,720 points
767 views