Bring Your Logic using Python
342 subscribers
109 photos
1 video
4 files
544 links
Logic building using Python : Materials, links, e-books and Code snippets
Download Telegram
Did you know that you can give #Python's print an iterator and a separator?

So in this example you don't need the for loop
Elegant #Python: use * to unpack a sequence.
#Python functions are first-class objects so you can access their attributes like this.
The #Python requests library lets you conveniently choose if you want to raise an exception or not.
Did you know #Python's random module has a function called "randrange" that lets you choose a random item from range(start, stop[, step]) ?
In #Python you can chain comparison operators ...

Instead of writing "1 < a and a < 10" you can write "1 < a < 10", a bit more concise.
👴 #Python wisdom for the day: you can directly call methods on integers (remember, Python is fully object-oriented; no automatic boxing needed here 😉)
🐍Python Tip: To convert your strings to be URL friendly. For example, when constructing an API request/query strings, you can use urllib's quote method like so 👆🏻
#networkautomation #python #python3