Python Foundations for Network Engineers Flashcards
list characteristics of Python 2.x
- No longer developed, but supported by community
- Better library support
- Default on Linux and Mac
- Supported by Cisco NX-OS
list characteristics of Python 3.x
- Under active development
- Easier to learn (note: design goal)
- Fixed major issues in 2.x
- Not backwards compatible
why shebang is needed
!/usr/bin/env python is needed in Linux and Mac for the script to execute on a correct program path
returns documentation about the object
.help()
returns the attributes and methods the object or module has
.dir()
returns the type of the object
.type()
what the python style guide is called
PEP8
what pythonic means
idiomatic python, which is concerced about readability and uniformity
what means strings are immutable
individual characters cannot be modified after the string has been created
how to print an empty line in Python
“\n”
what is concatenation
adding multiple strings together
list built-in methods for strings
- .upper() and .lower()
- .replace()
- .startswith()
- .format()
- .split()
how to refer to the last element in a list
sample_list[-1]
what are the common built-in methods for lists
.append() .pop() .insert() .count() .extend() .sort()
what is the item of a dictionary called
key-value pair