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
507 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
591 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,565 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
745 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
586 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
946 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
602 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
491 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
755 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
355 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
404 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
451 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,369 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
454 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
526 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
446 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,306 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,360 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
330 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
462 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,864 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
743 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
441 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
514 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
788 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
313 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
450 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
571 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
501 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
381 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
370 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
568 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
507 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
413 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
546 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
391 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
425 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
460 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
455 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,886 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
827 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
381 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,006 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
416 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,185 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,662 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
610 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
484 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
582 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
507 views