Python Strings:
• quotes: use (’) or (”), be consistent
• escaping: use a backlash (’\’)
• concatenation: use the plus sign (’+’) to put strings together
• length: use the len() function to get the length of a string
• more: join(), replace(), find(), and others
Variables, Objects, and References:
• everything in Python is an object and variables are references to objects
• a = 5 creates a variable ‘a’, which points to the object containing value ‘5’
• b = a creates another variable ‘b’, which references the same object as ‘a’
If you then change the value that ‘a’ points to, Python creates another object, and now the values of ‘a’ and ‘b’ are referencing different objects.
>>> a = a + 2
>>> a
7
>>> b
5
Code Blocks / Indentation:
• Python does not have ’begin’ and ’end’ delimiters such as curly brackets (’{}’)
• Python uses indentation to identify statements in a code block; must be uniform and consistent
• use spaces for indentation, not tabs
Commenting Your Code:
• use comments to explain the purpose of a line or section of code
• update the comments if the code changes
• everything following ‘#’ until the end of line is a part of the comment
• use triple quotes (“””) for multi-line comments
Input/Output Basics:
• opening a file: specify the filename and the intended mode
• closing the file: free up system resources once the application has completed
• filename: prefer relative path over absolute path
• mode: read (default), write, read + write, or append
Reading From A File:
• read(): reads some quantity of data (specific size or whole file) and returns it as a string
• readline(): reads a single line from the file and returns it as a string
• readlines(): reads all the lines of a file and returns it as a list
For reading lines from a file, you can also loop over the file object. This is memory efficient, fast, and leads to simple code:
file = open(filename, mode)
for line in file:
print(line)
Why Network Programmability
• problem: network management is box-by-box, CLI driven, and often complex
• a static network infrastructure deteriorates the application experience
• solution: network programmability enables automating deployments and simplifying the network
Network Programmability Benefits - Simplified Networking
• a high percentage of ”network down” events are due to misconfiguration
• simplified networking saves time and money, reduces human error, and directs resources from operating the network to innovating with the network
• Example: QoS is often configured incorrectly or not configured at all due to complexity. A simple change requires manual configuration across the network. Network programmability enables a simple application to quickly deliver consistent and accurate QoS configuration changes.
I read the above article and I got some knowledge from your article.engineering consultancy It's actually great and useful data for us. Thanks for share it.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete