Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Using Databases in Python!
You have completed Using Databases in Python!
Preview
If we're going to have a diary, we have to be able to add entries to it. Let's use sys.stdin so we can capture new lines and tabs and all sorts of other goodies.
New terms
-
sys- a Python module that contains functionality for interacting with the system -
sys.stdin- a Python object that represents the standard input stream. In most cases, this will be the keyboard
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Let's write the function that'll actually
let us add entries to the database.
0:00
Python comes with a library named SYS that
relates to system functionality on
0:01
your computer.
0:05
We're gonna use a great feature of that
library, STDIN, so
0:06
that we can capture an entry that has new
lines in it.
0:09
Since we're going to be using the sys
library, we should probably go ahead and
0:12
import it.
0:16
[BLANK_AUDIO]
0:17
Not that it's really important, but
0:19
I'd like to point out that we have the
stuff that comes from Python here, and
0:21
then a blank line, and then the stuff that
comes from a third-party library.
0:24
This is a really good and really common
way of organizing your imports.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up