Most voted questions in Python

0 votes
1 answer

What are the key features of Python?

If it makes for an introductory language ...READ MORE

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

Mean and average in numpy

np.average() can be used to calculate weighted ...READ MORE

Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
584 views
0 votes
1 answer

Printing a large numpy array

numpy.set_printoptions(threshold='nan') READ MORE

Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
1,556 views
0 votes
2 answers

What are the types of dictionary in python?

There are 4 types of dictionary Empty Integer Mixed Dictionary with ...READ MORE

Feb 14, 2019 in Python by Shashank
• 1,370 points
725 views
0 votes
1 answer

What is the flow control for “continue” in python?

This is the way "continue" statement works! You ...READ MORE

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

Combining numpy arrays

There is concatenation function for numpy arrays ...READ MORE

Jul 3, 2018 in Python by Hamartia's Mask
• 1,580 points
940 views
0 votes
1 answer

Numpy data in csv

Use this -  numpy.savetxt("data.csv", arr, delimiter=",") READ MORE

Jul 3, 2018 in Python by Hamartia's Mask
• 1,580 points
592 views
0 votes
2 answers

Lists and Tuples

Lists are mutable homogeneous sequences whereas tuples ...READ MORE

Jul 17, 2018 in Python by Mrunal
• 680 points
487 views
0 votes
1 answer

Append & Extend

Hi. This question has already been answered. Take ...READ MORE

Jul 2, 2018 in Python by Nietzsche's daemon
• 4,260 points
749 views
0 votes
1 answer

Searching for substrings

Use the in operator to do this. If ...READ MORE

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

Convert dictionary keys to a list

list.(dictionary.keys()) READ MORE

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

Multiple line comment in python

No, you can simply use triple codes ...READ MORE

Jun 28, 2018 in Python by v.liyyah
• 1,300 points
443 views
0 votes
1 answer

How to get text label from SAP using pywinauto[python]

Hi. Can you please tell me what ...READ MORE

Jun 28, 2018 in Python by Nietzsche's daemon
• 4,260 points
2,349 views
0 votes
1 answer

Modules and Packages

A module is a single file imported ...READ MORE

Jun 27, 2018 in Python by Hamartia's Mask
• 1,580 points
449 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
517 views
0 votes
1 answer

Chaining comparision

I assume you are talking about this ...READ MORE

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

ImportError: No module named requests

Requests is not available for use by ...READ MORE

Jun 26, 2018 in Python by Hamartia's Mask
• 1,580 points
2,291 views
0 votes
3 answers

how to use print statement in python3?

Brackets are required to print the output. >>> ...READ MORE

Nov 25, 2021 in Python by anonymous
1,351 views
0 votes
1 answer

convert integer to strings

Yes, you can str() function. For example: a=10 str(a) output-' ...READ MORE

Jun 26, 2018 in Python by code.reaper12
• 3,500 points
324 views
0 votes
1 answer

Copying dictionaries

Deep copy -  dict2 = dict(dict1) Shallow copy - dict2 ...READ MORE

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

Difference between pop and delete methods

I think you mean del() and not ...READ MORE

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

.pyc files in python

.pyc files contain the bytecode which are ...READ MORE

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

List all contents of a folder

Use listfor() from the os library READ MORE

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

Call a shell command in Python?

Try this - os.system("commands and arguments") READ MORE

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

dunder main in python

It is a check to see if ...READ MORE

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

Deleting files

Use the rmtree() method from shutil library. ...READ MORE

Jun 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
311 views
0 votes
1 answer

Copying files

copyfile(src, dst) This is from the shutil library https://d ...READ MORE

Jun 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
444 views
0 votes
1 answer

Creating a matrix in Python

You can create arrays of any number ...READ MORE

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

Split a string into a list of characters

This is easy. Just use the list() ...READ MORE

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

Print contents of a folder

There is a function provided in python ...READ MORE

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

Sorting a dictionary

It is not possible to sort to ...READ MORE

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

Using sequences

Lists are like arrays, except that their ...READ MORE

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

Compare dates

>>> from datetime import datetime >>> past = ...READ MORE

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

Using exceptions in Python

They are used for control flow. Check ...READ MORE

Jun 14, 2018 in Python by Nietzsche's daemon
• 4,260 points
401 views
0 votes
1 answer

Pythonic Switch statement

You can implement it using dictionaries  def numbers_to_strings(argument): ...READ MORE

Jun 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
538 views
0 votes
1 answer

reversing a list

Use the reverse function!  list_1.reverse() READ MORE

Jun 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
385 views
0 votes
1 answer

Python Whitespace for indenting

PEP-8 recommends creating indents by tapping the ...READ MORE

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

Install mysqldb module

pip install mysqlclient READ MORE

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

Swapping values

a,b = b,a Here, python interprets the comma ...READ MORE

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

Rename a key in dict

dictionary[new_key] = dictionary.pop(old_key) READ MORE

Jun 8, 2018 in Python by Hamartia's Mask
• 1,580 points
7,875 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
821 views
0 votes
1 answer

Create an empty array

You don't have to. The size of ...READ MORE

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

Extract element from a set without removing it

Use iter(): element = next(iter(set_1)) READ MORE

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

Combine list items to a string

>>> stmt = ['this','is','a','statement'] >>> ' '.join(sentence) 'this is ...READ MORE

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

Storing a list of arrays into a CSV file and retrieving it back in a different program

This is the code that I am ...READ MORE

Jun 7, 2018 in Python by aryya
• 7,450 points
2,178 views
0 votes
0 answers

Cannot make connection to .accdb file using python

I am writing a script that needs ...READ MORE

Jun 7, 2018 in Python by aryya
• 7,450 points
1,660 views
0 votes
1 answer

Normal Python code equivalent to given list comprehension

You can try this code list1=[] for i in ...READ MORE

Jun 8, 2018 in Python by jain12
• 170 points
602 views
0 votes
2 answers

Delete a character from pythons string

If you want to remove the 'J' ...READ MORE

Jun 12, 2018 in Python by anonymous
472 views
0 votes
1 answer

Binary numbers in python

>>> 0b1011 11 READ MORE

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

What are the differences between type() and isinstance()?

To summarize the contents of other (already ...READ MORE

Jun 4, 2018 in Python by aryya
• 7,450 points
504 views