Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import os
- import sys
- def copy_to_clip(string):
- if(sys.platform == 'darwin'):
- cmd='echo \"' + string.strip()+'\" | pbcopy'
- else:
- cmd='echo \"' + string.strip()+'\" | clip'
- return subprocess.check_call(cmd, shell=True)
- while(1):
- userInput = raw_input('Enter the string to switch to sponge case. Ctrl + C or \'!exit!\' to quit program.\n')
- if(userInput == '!exit!'):
- exit()
- newString = ""
- previousLower = False
- for i in range(0,len(userInput)):
- if not userInput[i].isalpha():
- newString = newString + userInput[i]
- continue
- if previousLower:
- newString = newString + userInput[i].upper()
- previousLower = False
- else:
- newString = newString + userInput[i].lower()
- previousLower = True
- print newString
- try:
- copy_to_clip(newString)
- print "*Sponge case copied to keyboard*"
- except:
- continue
- #do nothing
Add Comment
Please, Sign In to add comment