Skip to content

Commit 2807710

Browse files
mcb runs great
1 parent bf1675c commit 2807710

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#! /usr/bin/python3.5
2+
3+
"""
4+
5+
Author: Samrat Banerjee
6+
Dated: 28/05/2018
7+
Description: PROJECT- Saves and loads pieces of text to the clipboard.
8+
9+
py.exe mcb.pyw save <keyword> - Saves clipboard to keyword.
10+
py.exe mcb.pyw <keyword> - Loads keyword to clipboard.
11+
py.exe mcb.pyw list - Loads all keywords to clipboard.
12+
13+
"""
14+
15+
import shelve, pyperclip, sys
16+
17+
mcbShelf=shelve.open('mcb')
18+
# Save clipboard content
19+
if len(sys.argv) == 3 and sys.argv[1].lower()=='save':
20+
mcbShelf[sys.argv[2]]=pyperclip.paste()
21+
#List keywords and load content
22+
elif len(sys.argv)==2:
23+
if sys.argv[1].lower() == 'list':
24+
pyperclip.copy(str(list(mcbShelf.keys())))
25+
elif sys.argv[1] in mcbShelf:
26+
pyperclip.copy(mcbShelf[sys.argv[1]])
27+
mcbShelf.close()

Chapter8–ReadingandWritingFiles/randomQuizGenerator.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)