<– Previous Print Statements, Variables, Dictionaries, & Lists
NETGEAR R6700 Nighthawk AC1750 Dual Band Smart WiFi Router, Gigabit Ethernet (R6700) Price $89.99
Modules are packaged python classes that you can use to do specific functions in order to get your work done quicker. In fact, python excels at getting you to the finish list sooner. This has made it a popular choice for implementation of high level applications. Let python do the heavy lifting, and just get your idea out there.
In this post, we will be going through some simple import examples to get you comfortable using them.
Lets begin with time.
import time
print(time.time())
This will give you a different value depending on when you run it. In fact, unless we run this at the same time(unlikely), this value will always be unique between you and I:
1549641433.74
There’s another really useful method call in the time module, sleep. Sleep pauses the execution of your code for a specified number of seconds. sleep(<seconds>).
NOTE(If you’ve already imported time, don’t import it again, no need to)
print("wait a second")
time.sleep(1)
print("Okay")
Learn Basic Electronics with this Hands-On Course!
Lets look at sys next:
import sys
print(sys.modules)
I won’t print them all here, but this should list all of the modules you have currently loaded. Notice time and sys are listed. Cool huh?
Try this one:
print(sys.platform)
You should see your machine platform printed in the console.
Next- Conditionals & Loops & Indentation –>
NETGEAR R6700 Nighthawk AC1750 Dual Band Smart WiFi Router, Gigabit Ethernet (R6700) Price $89.99
2 Comments