#100DaysOfCode in Python Transcripts
Chapter: Days 67-69: Copy and Paste with Pyperclip
Lecture: Concepts: what did we learn
0:00 And, that was pyperclip.
0:01 You can see it's pretty fun, isn't it?
0:04 So, there are a lot of different things you can do with it.
0:06 Used cases, I'm sure you're starting to think of,
0:09 which is good because,
0:10 well we'll discuss that in just a minute.
0:12 Let's recap everything we did, okay?
0:15 Just a quick overview, I'll make it very fast.
0:18 We're importing pyperclip, okay?
0:20 We paste what's on the clipboard
0:23 into your code using pyperclip.paste, okay?
0:27 Then, we copy anything between the copy brackets,
0:31 we copy that back to the clipboard using pyperclip.copy.
0:36 Alright, our affiliate script, okay?
0:40 We assigned the paste, okay.
0:42 Everything that was on the clipboard we assigned it
0:44 to a variable, right?
0:47 And, then the only tricky thing, I suppose,
0:49 was that we were checking to see if the word "amazon"
0:52 was in our URL, and if it wasn't,
0:55 then we said it was an invalid link.
0:57 And, if it was, it then appended the affiliate code
1:01 onto the end of the URL.
1:04 Really simple stuff, very useful.
1:06 Obviously, no fact checking to the max, anyway
1:10 because if you just put amazon.com, that would pass
1:13 but that's not a valid affiliate link, okay?
1:18 Right, then we built a text replacer script,
1:21 which is also a lot of fun.
1:22 Maybe not as useful, but really really fun anyway.
1:26 So, we imported pyperclip again.
1:28 Alright, we pasted what was on the clipboard back in,
1:32 into our code, alright.
1:34 We replaced it using user specified text.
1:39 Okay, they got to choose what they wanted to be replaced,
1:42 and then they got to typing the word or words
1:46 that they wanted to replace it with.
1:49 Alright, and once that was done,
1:52 it then copied back to the clipboard.
1:55 Easy peasy.
1:58 Alright, now it's your turn.
1:59 So, pyperclip, one really cool thing with clipboards
2:04 is that you can actually make a clipboard
2:07 that has persistent memory, so to speak, okay?
2:12 Once you copy something onto the clipboard,
2:14 it's saved there and you can look at your history
2:17 of copies, everything that you've copied to the clipboard.
2:21 I think that would be a very, very cool use case
2:24 for pyperclip.
2:25 So, for you Day 3, think about how you can copy what's
2:29 on the clipboard, and if anything is copied to the clipboard
2:33 come up with a way to store it, perhaps
2:35 and maybe make some sort of application
2:38 that will then have your history of everything
2:41 that you've copied.
2:43 That would be very cool.
2:44 If not, if that's too complicated
2:46 and you don't have much time.
2:47 Well then, just go ahead and think about the things
2:50 that you copy and paste on a daily basis.
2:53 You could use this as a simple thing
2:55 to make your own password vault
2:58 and whatever else you can think of,
3:00 so come up with something that uses pyperclip
3:02 and code that for your Day 3.