简体   繁体   中英

Python unresolved import win32clipboard

I just tried to use the following code:

data = win32clipboard.GetClipBoardData(win32clipboard.CF_TEXT)

Error is

Error = module 'win32clipboard' has no attribute 'GetClipBoardData'

when I try to import win32clipboard it says unresolved import. Any ideas?

You've misspelled GetClipBoardData() - should have been GetClipboardData()

Importing the win32.win32clipboard solves the intellisense issues:

import win32.win32clipboard as clip
clip.OpenClipboard()
data = clip.GetClipboardData(clip.CF_TEXT)
clip.CloseClipboard()
print(data)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM