Most viewed questions in Python

0 votes
1 answer

What are namespaces in Python?

Namespace is basically a way to implement ...READ MORE

Oct 31, 2018 in Python by SDeb
• 13,300 points
536 views
0 votes
0 answers

Python | Combine two bots into one

Hi everyone, Basically i made a bot in ...READ MORE

Jun 30, 2020 in Python by PrKit
• 120 points
535 views
0 votes
0 answers

how do i check the version of opencv?

it there a command to run in ...READ MORE

May 3, 2019 in Python by Waseem
• 4,540 points
535 views
0 votes
1 answer

Power Math in Python

When you use "^" operator, it is ...READ MORE

Nov 12, 2018 in Python by ana1504.k
• 7,910 points
535 views
0 votes
1 answer

Replacements for switch statement in Python?

You could use a dictionary: def f(x): ...READ MORE

May 29, 2018 in Python by aryya
• 7,450 points
535 views
0 votes
1 answer

How to create the following pattern using Python?

Hi, @Roshni, You can use two for-loops for ...READ MORE

Jun 26, 2020 in Python by Gitika
• 65,910 points
534 views
0 votes
1 answer

How to access list in Python?

A list is created by adding comma ...READ MORE

Mar 4, 2019 in Python by Priyaj
• 58,090 points
534 views
0 votes
1 answer

How can I print Lists in python

print is a function in Python 3.x, so ...READ MORE

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

Where can I get the list of Python keywords?

Just import a module “keyword”. Here you ...READ MORE

Apr 20, 2018 in Python by aayushi
• 750 points
533 views
0 votes
0 answers

Why do i get this error in tkinter - Python?

This is my code: from tkinter import * root ...READ MORE

Oct 10, 2021 in Python by LogizTV
• 120 points
532 views
0 votes
1 answer

yield keyword in Python

The yield keyword is used along with ...READ MORE

Jul 9, 2019 in Python by Wajiha
• 1,950 points
532 views
0 votes
0 answers

What does a ternary conditional operator do in python?

Can you give an example using a ...READ MORE

Jun 17, 2019 in Python by Waseem
• 4,540 points
532 views
0 votes
1 answer

Print Delimited list

You can try the following and see ...READ MORE

Feb 28, 2019 in Python by SDeb
• 13,300 points
532 views
0 votes
1 answer

How do I append one string to another in Python?

If you only have one reference to ...READ MORE

Oct 22, 2018 in Python by SDeb
• 13,300 points
532 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
531 views
0 votes
1 answer

Change log-level via mocking

A way to do this without mocking ...READ MORE

Jun 4, 2019 in Python by SDeb
• 13,300 points
531 views
0 votes
1 answer

Comparing two files contents in python

Considering your file "Unique.txt" does just containt the IP ...READ MORE

Sep 11, 2018 in Python by Priyaj
• 58,090 points
531 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
529 views
0 votes
1 answer

How to get size of a list?

Hi, You can use built-in function "len" to ...READ MORE

Jun 21, 2019 in Python by Shabnam
• 930 points
529 views
0 votes
1 answer

Best way to open a socket in Python

Opening sockets in python is pretty simple. ...READ MORE

Feb 21, 2019 in Python by SDeb
• 13,300 points
529 views
0 votes
1 answer

NumPy Array Indexing

If you want to create a subarray ...READ MORE

Jul 26, 2019 in Python by SDeb
• 13,300 points
528 views
0 votes
0 answers

How i can open a storage based pdf file in chrome full screen mood using python?

i have a pdf file stored in ...READ MORE

Mar 12, 2020 in Python by junaid
• 120 points

retagged Mar 12, 2020 by junaid 526 views
0 votes
1 answer

Callable objects approach vs nested scope approach to create higher order functions - python

Using callable objects has a disadvantage over ...READ MORE

Jul 25, 2019 in Python by Vivan
526 views
0 votes
1 answer

How to add elements to a list in Python?

To initialize an empty list do this: new_list ...READ MORE

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

Namespace in Python

Namespace is a way to implement scope. In ...READ MORE

Nov 21, 2018 in Python by SDeb
• 13,300 points
526 views
0 votes
0 answers

How do you implement insertion sort in python?

Can you give the sample code as ...READ MORE

Jun 19, 2019 in Python by Waseem
• 4,540 points
525 views
0 votes
1 answer

How to solve indentation in the below code?

Python does not use brackets, it uses ...READ MORE

Feb 9, 2019 in Python by Omkar
• 69,230 points
525 views
0 votes
1 answer

I have a dictonary in python how to access the value field?

dic={"car":["limo","sedan"]} print (dic.keys())    <-----------------------Fetch the key "car" print (dic['car'][0])   <------------------------Fetch ...READ MORE

Dec 20, 2018 in Python by Shuvodip
525 views
0 votes
1 answer

How can I set Django Cookies?

Hello @kartik, This is a helper to set ...READ MORE

Aug 12, 2020 in Python by Niroj
• 82,880 points
524 views
+1 vote
1 answer

I wanted to change the entire row where index is 9 how can i do that

Import the file as a pandas dataframe ...READ MORE

Sep 16, 2019 in Python by Rishi
523 views
0 votes
1 answer

Python - abs vs fabs

math.fabs() converts its argument to float if it ...READ MORE

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

How to read photo using cv2 module in python?

Hi@akhtar, Yes, you can read your image in ...READ MORE

Apr 9, 2020 in Python by MD
• 95,440 points
522 views
0 votes
1 answer

Enter a 1-10, each on a new line in a file - python

Try something like this: i=1 for i in range(10): ...READ MORE

Jun 20, 2019 in Python by Greg
522 views
0 votes
2 answers

How to use virtual environment in Python?

venv (for Python 3) and virtualenv (for Python 2) allow ...READ MORE

Aug 25, 2020 in Python by Pistle
• 300 points
522 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
520 views
0 votes
1 answer

Extracting extension from filename in Python

Yes. Use os.path.splitext >>> import os >>> filename, file_extension = ...READ MORE

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

What is the basic difference between T-Test, Z-Test, Chi-Square and Annova test?

If we are using one numerical variable ...READ MORE

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

How to eliminate out outliers in a dataframe?

There are various ways we can replace ...READ MORE

Jul 24, 2019 in Python by Shri
520 views
0 votes
1 answer

Array values in Python

You can use the enumerate function and ...READ MORE

Nov 28, 2018 in Python by SDeb
• 13,300 points
520 views
0 votes
1 answer

How to use “raise” keyword in Python

You can use it to raise errors ...READ MORE

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

Representing infinity

import math infinity = math.inf Now you can use ...READ MORE

Jun 27, 2018 in Python by Hamartia's Mask
• 1,580 points
520 views
0 votes
0 answers

for label, value in s.iteritems(): s.set_value(label, value+2) s.head()

READ MORE

Jun 6, 2020 in Python by WELL
• 140 points

recategorized Jun 8, 2020 by Gitika 519 views
0 votes
1 answer

Access the sole element of a set

Use set.pop: >>> {1}.pop() 1 >>> In your case, it would be: return ...READ MORE

Jun 28, 2019 in Python by SDeb
• 13,300 points
519 views
0 votes
1 answer

% operator in Python

When you use '(%g,%g)', it is the ...READ MORE

Nov 12, 2018 in Python by ana1504.k
• 7,910 points
518 views
0 votes
1 answer

Python logical operator 'and'

If you use and on two or ...READ MORE

Jan 28, 2019 in Python by Omkar
• 69,230 points
517 views
0 votes
1 answer

What is a “method” in Python?

It's a function which is a member ...READ MORE

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

What does hash do in python?

A hash is an fixed sized integer ...READ MORE

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

Python comments

Use docstrings for multi-line commenting -  """ Line 1 Line ...READ MORE

May 7, 2018 in Python by Nietzsche's daemon
• 4,260 points
517 views
0 votes
1 answer

How can I go about using var == False in Python?

Hi. Simple answer.  All you need to do ...READ MORE

Feb 13, 2019 in Python by Nymeria
• 3,560 points
516 views