Skip to content

Commit

Permalink
Small fixes chapter 10
Browse files Browse the repository at this point in the history
  • Loading branch information
natenka committed Jun 27, 2021
1 parent 2647e84 commit dda2268
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/source/book/10_useful_functions/all_any.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ For example, it is possible to check that all octets in an IP address are number

.. code:: python
In [4]: IP = '10.0.1.1'
In [4]: ip = '10.0.1.1'
In [5]: all(i.isdigit() for i in IP.split('.'))
In [5]: all([i.isdigit() for i in ip.split('.')])
Out[5]: True
In [6]: all(i.isdigit() for i in '10.1.1.a'.split('.'))
In [6]: all([i.isdigit() for i in '10.1.1.a'.split('.')])
Out[6]: False
any
Expand All @@ -42,7 +42,7 @@ Function ``any`` returns True if at least one element is true.
In [9]: any([])
Out[9]: False
In [10]: any(i.isdigit() for i in '10.1.1.a'.split('.'))
In [10]: any([i.isdigit() for i in '10.1.1.a'.split('.')])
Out[10]: True
For example, with ``any`` you can replace ``ignore_command`` function:
Expand Down Expand Up @@ -74,5 +74,5 @@ To this option:
'''
ignore = ['duplex', 'alias', 'Current configuration']
return any(word in command for word in ignore)
return any([word in command for word in ignore])

0 comments on commit dda2268

Please sign in to comment.