Tag: io

66 votes
30 answers
2.8K views
AngularJS: Service vs provider vs factory

What are the differences between a Service, Provider and Factory in AngularJS?

avatar
Chelsea
0 1 0 9
asked 07 September, 2021
57 votes
29 answers
1.5K views
How do I parse a string to a float or int?

In Python, how can I parse a numeric string like "545.2222" to its corresponding float value, 545.2222? Or par

avatar
Carmelina
0 1 0 9
asked 07 September, 2021
60 votes
22 answers
2.4K views
How do you change the size of figures drawn with Matplotlib?

How do you change the size of figure drawn with Matplotlib?

avatar
Keith
0 1 0 9
asked 07 September, 2021
63 votes
30 answers
996 views
How can I install pip on Windows?

pip is a replacement for easy_install. But should I install pip using easy_install on Windows? Is there a bett

avatar
Jeff
0 1 0 9
asked 07 September, 2021
55 votes
13 answers
562 views
How to delete a file or folder in Python?

How do I delete a file or folder in Python?

avatar
Boyd
0 1 0 9
asked 07 September, 2021
49 votes
10 answers
942 views
Manually raising (throwing) an exception in Python

How can I raise an exception in Python so that it can later be caught via an except block?

avatar
Royal
0 1 0 9
asked 07 September, 2021
58 votes
16 answers
506 views
55 votes
23 answers
870 views
What does ** (double star/asterisk) and * (star/asterisk) do for parameters?

In the following method definitions, what does the * and ** do for param2? def foo(param1, *param2): def bar(

avatar
Kristopher
0 1 0 9
asked 07 September, 2021
50 votes
29 answers
3K views
How do I concatenate two lists in Python?

How do I concatenate two lists in Python? Example: listone = [1, 2, 3] listtwo = [4, 5, 6] Expected outcom

avatar
Tana
0 1 0 9
asked 07 September, 2021
54 votes
20 answers
1.4K views
How can I add new keys to a dictionary?

Is it possible to add a key to a Python dictionary after it has been created? It doesn't seem to have an

avatar
Venice
0 1 0 9
asked 07 September, 2021
61 votes
5 answers
2.4K views
Catch multiple exceptions in one line (except block)

I know that I can do: try: # do something that may fail except: # do this if ANYTHING goes wrong I

avatar
Chaya
0 1 0 9
asked 07 September, 2021
64 votes
30 answers
720 views
57 votes
14 answers
1.9K views
Iterating over dictionaries using 'for' loops

I am a bit puzzled by the following code: d = {'x': 1, 'y': 2, 'z': 3} for key

avatar
Hilario
0 1 0 9
asked 07 September, 2021
62 votes
20 answers
903 views
How to make a flat list out of a list of lists

Is there a shortcut to make a simple list out of a list of lists in Python? I can do it in a for loop, but is

avatar
Karolyn
0 1 0 9
asked 07 September, 2021
64 votes
28 answers
2.7K views
How can I safely create a nested directory in Python?

What is the most elegant way to check if the directory a file is going to be written to exists, and if not, cr

avatar
Dorian
0 1 0 9
asked 07 September, 2021
59 votes
30 answers
2.5K views
How do I merge two dictionaries in a single expression (taking union of dictionaries)?

I have two Python dictionaries, and I want to write a single expression that returns these two dictionaries, m

avatar
Thurman
0 1 0 9
asked 07 September, 2021
54 votes
27 answers
1.6K views
Does Python have a ternary conditional operator?

If Python does not have a ternary conditional operator, is it possible to simulate one using other language co

avatar
Mikki
0 1 0 9
asked 07 September, 2021
68 votes
30 answers
1.2K views
What does if __name__ == "__main__": do?

Given the following code, what does the if __name__ == "__main__": do? # Threading example import time, threa

avatar
Trudy
0 1 0 9
asked 07 September, 2021
51 votes
16 answers
1.9K views
Wordpress keeps redirecting to install-php after migration

Here's my situation. I have followed the exact instructions on wordpress codex page about moving a site t

avatar
Daniel
0 1 0 9
asked 07 September, 2021
51 votes
3 answers
2.5K views
JointsWP4 (SASS): Changing Properties in Sticky

TL;DR: Is Sticky actually able to react to changes I give through JavaScript? If so, how? (The project is usi

avatar
Fabian
0 1 0 9
asked 07 September, 2021