Most answered questions in Python

0 votes
11 answers

“pip install unroll”: “python setup.py egg_info” failed with error code 1

rm -rf node_modules READ MORE

Jun 27 in Python by anonymous
10,371 views
+2 votes
11 answers

How to print array/ list without brackets in python?

print(*names, sep = ', ') This is what ...READ MORE

Dec 10, 2018 in Python by Sudo
27,133 views
+7 votes
8 answers

Difference for string comparison in Python: 'is' vs. ==

If we use "==" means both variables ...READ MORE

Sep 3, 2018 in Python by Parul Raheja
482 views
+4 votes
8 answers

How can I use Python's range function?

The range function is mostly used in for-loop.  Ex: for ...READ MORE

Aug 21, 2018 in Python by Omkar
• 67,600 points
64 views
+4 votes
7 answers

Splitting a List into chunks in Python

Here's a generator that yields the chunks ...READ MORE

Apr 13, 2018 in Python by Nietzsche's daemon
• 4,260 points
6,283 views
+4 votes
7 answers

What is an array in Python? How to declare it?

Python doesn't have a native array data ...READ MORE

Apr 11, 2018 in Python by anto.trigg4
• 3,420 points
245 views
+3 votes
7 answers

How can I rename a file in Python?

yes, you can use "os.rename" for that. ...READ MORE

Mar 31, 2018 in Python by DareDev
• 6,810 points
164 views
+2 votes
6 answers

What exactly is the function of random.seed() in python?

The seed method is used to initialize the ...READ MORE

Oct 29, 2018 in Python by Rahul
25,529 views
+1 vote
6 answers

how python trim works

You want strip(): myphrases = [ " Hello ...READ MORE

Oct 18, 2018 in Python by up4rescue
120 views
+2 votes
6 answers

How can I change directory or "cd" in Python?

Context Manager: cd import os class cd:     """Context manager for ...READ MORE

Oct 18, 2018 in Python by Nabarupa
122 views
+2 votes
6 answers

Slicing in Python

Index: ------------> ...READ MORE

Oct 18, 2018 in Python by abc
79 views
+4 votes
6 answers

Substring search in Python

Use the "in" operator in python" if "substring" ...READ MORE

Apr 13, 2018 in Python by Nietzsche's daemon
• 4,260 points
93 views
+4 votes
6 answers

Does Python have a ternary conditional operator like C does?

Yes, the syntax is: a if condition else ...READ MORE

Apr 13, 2018 in Python by Nietzsche's daemon
• 4,260 points
138 views
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

Apr 11, 2018 in Python by hemant
• 5,750 points
187 views
+4 votes
6 answers

Use of "continue" in python

The break statement is used to "break" ...READ MORE

Jul 16, 2018 in Python by Omkar
• 67,600 points
133 views
0 votes
5 answers

What to study in Python to do freelancing using this?

Hello, you are on the right track. ...READ MORE

Feb 27 in Python by Priyaj
• 56,900 points
79 views
+3 votes
5 answers

is python compatible with Linux?

Just follow these three commands and you ...READ MORE

Sep 12, 2018 in Python by charlie_brown
• 7,720 points
92 views
+1 vote
5 answers

convert string to int python

Using list comprehensions: t2 = [map(int, list(l)) for ...READ MORE

Oct 18, 2018 in Python by donald
78 views
+1 vote
5 answers

Check whether the file exists or not?

Use this import os os.path.exists(path) # Returns whether the ...READ MORE

Oct 18, 2018 in Python by reyam
92 views
+3 votes
5 answers

How to read multiple data files in python

Firstly we will import pandas to read ...READ MORE

Apr 6, 2018 in Python by DeepCoder786
• 1,720 points
2,190 views
0 votes
4 answers

How to write a single program in python to print different '*' triangles?

If you want to use the same ...READ MORE

Jun 11 in Python by Likhith
287 views
+6 votes
4 answers

Python and Pygame: Difference

Python is a programming language. PyGame is a ...READ MORE

Oct 24, 2018 in Python by Priyaj
• 56,900 points
126 views
+1 vote
4 answers

Comparing input functions

In Python raw_input() allows you to enter ...READ MORE

Oct 18, 2018 in Python by fuji
39 views
+1 vote
4 answers

Count the frequency of an item in a python list

To count the number of appearances: from collections ...READ MORE

Oct 18, 2018 in Python by tinitales
1,098 views
+1 vote
4 answers

How can I concatenate str and int objects?

If you want to concatenate int or ...READ MORE

Oct 18, 2018 in Python by subhm
50 views
+2 votes
4 answers

python 2d array

You should make a list of lists, ...READ MORE

Oct 18, 2018 in Python by ritu
103 views
+1 vote
4 answers

How to write nested dictionaries to a CSV file

Using DictWriter there is no need in ...READ MORE

Oct 18, 2018 in Python by Richard William
5,493 views
0 votes
3 answers

Python pandas: TypeError: tuple indices must be integers or slices, not str

In fact, I get a perfectly good ...READ MORE

Jun 13 in Python by Alok
3,357 views
0 votes
3 answers

What is a Tuple in Python and how to use it?

it is a python sequency which stores ...READ MORE

Jul 17 in Python by mounika reddy
150 views
0 votes
3 answers

Is python version 3.7.2 supported by pycharm jetbrains IDE?

Yes it works fine.. READ MORE

Feb 27 in Python by Pratosh kumar
157 views
+1 vote
3 answers

PYTHON: Who could help?

A quick solution is to use the collections ...READ MORE

Nov 26, 2018 in Python by Omkar
• 67,600 points
49 views
0 votes
3 answers

What is the python keyword “with” used for?

The with statement in Python simplifies exception ...READ MORE

Jul 19 in Python by rahul
• 200 points
64 views
+1 vote
3 answers

What are the ways of detecting outliners in Python

code from http://eurekastatistics.com/using-the-median-absolute-deviation-to-find-outliers  This uses the L1 distance ...READ MORE

Aug 24, 2018 in Python by eatcodesleeprepeat
• 4,670 points

reshown Aug 24, 2018 by Priyaj 72 views
+1 vote
3 answers

How to run the Python program forever?

you can also do the old fashioned ...READ MORE

Jun 10 in Python by brianno
653 views
0 votes
3 answers

How to get the current time in Python

FOLLOWING WAY TO FIND CURRENT TIME IN ...READ MORE

Apr 8 in Python by rajesh
• 1,210 points
68 views
+1 vote
3 answers

What do you mean by python scripting? What is a script and a module in python?

A module is a file containing a ...READ MORE

Jun 17 in Python by Zain Abbas
8,008 views
0 votes
3 answers

What is python? Where it is used?

 Python is develop by Guido Van Rossum ...READ MORE

Mar 18 in Python by rajesh kumar
62 views
0 votes
3 answers

Python Selenium best tutorials for beginners

Hope this will help you...Python Tutorial READ MORE

Feb 11 in Python by aldrinjohn
• 140 points
1,215 views
+4 votes
3 answers

What does these operator mean **, ^, %, // ?

** - Performs exponential (power) calculation on ...READ MORE

Apr 11, 2018 in Python by anto.trigg4
• 3,420 points
53 views
+2 votes
3 answers

How can I play an audio file in the background using Python?

down voteacceptedFor windows: you could use  winsound.SND_ASYNC to play them ...READ MORE

Apr 3, 2018 in Python by charlie_brown
• 7,720 points
1,938 views
+2 votes
3 answers

what is the practical use of polymorphism in Python?

Polymorphism is the ability to present the ...READ MORE

Mar 31, 2018 in Python by anto.trigg4
• 3,420 points
1,486 views
0 votes
2 answers

How to declare constants in python?

In python we don't require to declare ...READ MORE

Aug 18 in Python by anonymous
• 460 points
24 views
+1 vote
2 answers

How to automate image upload from my computer to site using python-selenium?

Hey, this code worked for me: image_path=os.path.abspath('.\\folder1\\subfolder2\file1.jpg') driver.find_element_by_id("Id of ...READ MORE

Aug 19 in Python by Rishi
45 views
+1 vote
2 answers

Python error "ERROR: Could not find a version that satisfies the requirement PyQt4 (from versions: none)"

You cannot install PyQt directly from pip. ...READ MORE

Jul 22 in Python by Bob
2,694 views
0 votes
2 answers

How to check whether a string contains alphabets or number in Python?

By using isAlpha () to check whether ...READ MORE

Jul 13 in Python by Sheik janibasha
64 views
0 votes
2 answers

Write a for loop that prints all elements of a list and their position in the list. a = [4,7,3,2,5,9]

a = [4,7,3,2,5,9] b = enumerate(a) for i in ...READ MORE

Jul 15 in Python by Kei Tee

edited Jul 22 by Kalgi 366 views
0 votes
2 answers

How to check if a csv file is empty in pandas?

Try this: df = pd.DataFrame(columns=['Name', 'ID', 'Department']) if df.empty ...READ MORE

Jul 1 in Python by Bob
411 views
0 votes
2 answers

Check if there exists two elements in the array whose sum is equal to the sum of the entire array

You can try something like this Harsh: def ...READ MORE

Jun 17 in Python by Ayman
62 views
0 votes
2 answers

Python Error "UnicodeEncodeError: 'ascii' codec can't encode character u'\u03b1' in position 20: ordinal not in range(128)"

import csv import sys reload(sys) sys.setdefaultencoding('utf8') data = [["a", "b", u'\xe9']] with ...READ MORE

Jun 28 in Python by anonymous
455 views
0 votes
2 answers

What is the difference between python lists and arrays?

Python arrays and lists have the same ...READ MORE

Jun 10 in Python by Nisa
• 1,090 points
55 views