#100DaysOfCode in Python Transcripts
Chapter: Days 67-69: Copy and Paste with Pyperclip
Lecture: Concepts: what did we learn

Login or purchase this course to watch this video and the rest of the course contents.
0:00 And, that was pyperclip. You can see it's pretty fun, isn't it? So, there are a lot of different things you can do with it.
0:07 Used cases, I'm sure you're starting to think of, which is good because, well we'll discuss that in just a minute. Let's recap everything we did, okay?
0:16 Just a quick overview, I'll make it very fast. We're importing pyperclip, okay? We paste what's on the clipboard
0:24 into your code using pyperclip.paste, okay? Then, we copy anything between the copy brackets, we copy that back to the clipboard using pyperclip.copy.
0:37 Alright, our affiliate script, okay? We assigned the paste, okay. Everything that was on the clipboard we assigned it to a variable, right?
0:48 And, then the only tricky thing, I suppose, was that we were checking to see if the word "amazon" was in our URL, and if it wasn't,
0:56 then we said it was an invalid link. And, if it was, it then appended the affiliate code onto the end of the URL. Really simple stuff, very useful.
1:07 Obviously, no fact checking to the max, anyway because if you just put amazon.com, that would pass but that's not a valid affiliate link, okay?
1:19 Right, then we built a text replacer script, which is also a lot of fun. Maybe not as useful, but really really fun anyway.
1:27 So, we imported pyperclip again. Alright, we pasted what was on the clipboard back in, into our code, alright.
1:35 We replaced it using user specified text. Okay, they got to choose what they wanted to be replaced, and then they got to typing the word or words
1:47 that they wanted to replace it with. Alright, and once that was done, it then copied back to the clipboard. Easy peasy. Alright, now it's your turn.
2:00 So, pyperclip, one really cool thing with clipboards is that you can actually make a clipboard that has persistent memory, so to speak, okay?
2:13 Once you copy something onto the clipboard, it's saved there and you can look at your history
2:18 of copies, everything that you've copied to the clipboard. I think that would be a very, very cool use case for pyperclip.
2:26 So, for you Day 3, think about how you can copy what's on the clipboard, and if anything is copied to the clipboard
2:34 come up with a way to store it, perhaps and maybe make some sort of application that will then have your history of everything that you've copied.
2:44 That would be very cool. If not, if that's too complicated and you don't have much time. Well then, just go ahead and think about the things
2:51 that you copy and paste on a daily basis. You could use this as a simple thing to make your own password vault and whatever else you can think of,
3:01 so come up with something that uses pyperclip and code that for your Day 3.

Talk Python's Mastodon Michael Kennedy's Mastodon