clipboard
— Copy and paste¶The clipboard
module defines two simple functions to read and write to the text clipboard (a.k.a. pasteboard) on iOS.
Example:
#Convert clipboard to uppercase/lowercase
import clipboard
text = clipboard.get()
if text == '':
print('No text in clipboard')
else:
uppercase = text.upper()
if uppercase != text:
new_clip = uppercase
else:
#already uppercase, convert to lowercase
new_clip = text.lower()
clipboard.set(new_clip)
print(new_clip)
Functions in the clipboard
module:
clipboard.
get
()¶Returns the clipboard’s content as a unicode string.
clipboard.
set
(string)¶Sets the clipboard’s content to a new string or unicode string.