Skip to content

Commit 9134035

Browse files
committed
Merge pull request yasoob#82 from JoshMcCullough/patch-6
Small edits to One-Liners.
2 parents 26d3717 + 23ef1ba commit 9134035

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

one_liners.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
One Liners
1+
One-Liners
22
----------
33

4-
In this chapter I will show you some one liner Python commands which can
5-
be really helpful sometimes.
4+
In this chapter I will show you some one-liner Python commands which can
5+
be really helpful.
66

7-
**Simple Webserver**
7+
**Simple Web Server**
88

99
Ever wanted to quickly share a file over a network? Well you are in
10-
luck. Python has a similar feature just for you. Go to the directory
11-
which you want to serve over network and write the following code in
12-
terminal:
10+
luck. Python has a feature just for you. Go to the directory
11+
which you want to serve over the network and write the following code in
12+
your terminal:
1313

1414
.. code:: python
1515
@@ -19,9 +19,9 @@ terminal:
1919
# Python 3
2020
python -m http.server
2121
22-
**Pretty printing**
22+
**Pretty Printing**
2323

24-
You can print a list and dictionary in a beautiful format in Python
24+
You can print a list and dictionary in a beautiful format in the Python
2525
repl. Here is the relevant code:
2626

2727
.. code:: python
@@ -31,7 +31,7 @@ repl. Here is the relevant code:
3131
my_dict = {'name': 'Yasoob', 'age': 'undefined', 'personality': 'awesome'}
3232
pprint(my_dict)
3333
34-
This is more effective on dicts. Moreover, if you want to pretty print
34+
This is more effective on ``dict``s. Moreover, if you want to pretty print
3535
json quickly from a file then you can simply do:
3636
3737
.. code:: python
@@ -40,8 +40,8 @@ json quickly from a file then you can simply do:
4040
4141
**Profiling a script**
4242
43-
This can be extremely helpful in pin pointing the bottlenecks in your
44-
scripts.
43+
This can be extremely helpful in pinpointing the bottlenecks in your
44+
scripts:
4545
4646
.. code:: python
4747
@@ -77,7 +77,7 @@ is a simple example:
7777
# Output: [1, 2, 3, 4, 5, 6]
7878
7979
80-
**One Line Constructors**
80+
**One-Line Constructors**
8181

8282
Avoid a lot of boilerplate assignments when initializing a class
8383

@@ -88,5 +88,5 @@ Avoid a lot of boilerplate assignments when initializing a class
8888
self.__dict__.update({k: v for k, v in locals().items() if k != 'self'})
8989
9090
91-
A couple of more one liners can be found on the `Python
91+
Additional one-liners can be found on the `Python
9292
website <https://wiki.python.org/moin/Powerful%20Python%20One-Liners>`__.

0 commit comments

Comments
 (0)