• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pyperclip.copy函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyperclip.copy函数的典型用法代码示例。如果您正苦于以下问题:Python copy函数的具体用法?Python copy怎么用?Python copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了copy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: main

def main():
    parser = argparse.ArgumentParser(description='Generate secure, unique passwords based on a master password.')

    parser.add_argument('-c', '--confirm', dest='confirm', default=False, action='store_true',
        help='Require a confirmation of the master password.')

    parser.add_argument('-n', '--len', dest='n', default=24, type=int,
        help='The length of the password to generate. Defaults to 24, maximum 44')

    args = parser.parse_args()

    if args.n > 44:
        print 'Sorry, passwords with a length greater than 32 are not currently supported.'
        sys.exit(1)

    user_id = raw_input('account id: ')
    master_pw = getpass.getpass('password: ')

    if args.confirm:
        confirm_pw = getpass.getpass('confirm: ')
        if confirm_pw != master_pw:
            print 'Confirm failed.'
            sys.exit(1)

    pw = gen_password(master_pw, user_id, args.n)

    pyperclip.copy(pw)
    print 'Password copied to clipboard'

    time.sleep(10)

    pyperclip.copy('[cleared]')
    print 'Clipboard cleared'
开发者ID:josconno,项目名称:zerostore,代码行数:33,代码来源:zerostore.py


示例2: clip

 def clip(
     self,
     flows: typing.Sequence[flow.Flow],
     cuts: mitmproxy.types.CutSpec,
 ) -> None:
     """
         Send cuts to the clipboard. If there are multiple flows or cuts, the
         format is UTF-8 encoded CSV. If there is exactly one row and one
         column, the data is written to file as-is, with raw bytes preserved.
     """
     fp = io.StringIO(newline="")
     if len(cuts) == 1 and len(flows) == 1:
         v = extract(cuts[0], flows[0])
         if isinstance(v, bytes):
             fp.write(strutils.always_str(v))
         else:
             fp.write(v)
         ctx.log.alert("Clipped single cut.")
     else:
         writer = csv.writer(fp)
         for f in flows:
             vals = [extract(c, f) for c in cuts]
             writer.writerow(
                 [strutils.always_str(v) or "" for v in vals]  # type: ignore
             )
         ctx.log.alert("Clipped %s cuts as CSV." % len(cuts))
     try:
         pyperclip.copy(fp.getvalue())
     except pyperclip.PyperclipException as e:
         ctx.log.error(str(e))
开发者ID:cortesi,项目名称:mitmproxy,代码行数:30,代码来源:cut.py


示例3: run_VQUEST

def run_VQUEST(fasta_file, organism):
    g = open(fasta_file, "r")
    pyperclip.copy(g.read())
    g.close()

    fp = webdriver.FirefoxProfile()
    fp.set_preference("dom.max_chrome_script_run_time", 0)
    fp.set_preference("dom.max_script_run_time", 0)
    driver = webdriver.Firefox(firefox_profile=fp)
    driver.get("http://www.imgt.org/IMGT_vquest/vquest?livret=0&Option=" + organism + "Ig")
    driver.find_element_by_xpath("//input[@name='l01p01c05'][2]").click()
    driver.find_element_by_name("l01p01c10").clear()
    driver.find_element_by_name("l01p01c10").send_keys(Keys.COMMAND, 'v')
    driver.find_element_by_name("l01p01c12").click()
    driver.find_element_by_name("l01p01c13").click()
    driver.find_element_by_name("l01p01c06").click()
    driver.find_element_by_name("l01p01c14").click()
    driver.find_element_by_name("l01p01c15").click()
    driver.find_element_by_name("l01p01c16").click()
    driver.find_element_by_name("l01p01c41").click()
    driver.find_element_by_name("l01p01c22").click()
    driver.find_element_by_name("l01p01c23").click()
    driver.find_element_by_name("l01p01c19").click()
    driver.find_element_by_name("l01p01c18").click()
    driver.find_element_by_css_selector("input[type=\"SUBMIT\"]").click()

    output_file = fasta_file[:-4] + "_vquest.txt"
    print "Storing VQuest data to " + output_file + "\n"
    #make an output file and write the html output to that txt file                                     
    a= open(output_file, "w")
    a.write(driver.page_source)
    a.close()
    driver.quit()
开发者ID:denilau17,项目名称:Antibody2.0,代码行数:33,代码来源:antibody2.py


示例4: main

def main():
    ''' call all subfunctions to generate content '''

    stop_date = getStopDate()
#    stop_date = TZ.localize(datetime.strptime("01.06.2016", '%d.%m.%Y'))    
    print('Last Notizen: ' + stop_date.strftime('%d %b, %H:%M'))    
    
    output = ''
    output += '## [BLOG]\n'
    output += blog()
    output += '\n\n'

    output += '## [WIKI]\n'
    output += wiki(stop_date)
    output += '\n\n'

    output += '## [REDMINE]\n'
    output += redmine(stop_date)
    output += '\n\n'

    output += '## [MAILINGLISTE]\n'
    output += mail(stop_date)
    output += '\n\n'

    output += '## [GITHUB]\n'
    output += github(stop_date)
    output += '\n\n'


    print(output)

    pyperclip.copy(output)
开发者ID:Bytespeicher,项目名称:bytenews,代码行数:32,代码来源:bytenews.py


示例5: main

def main():
    """Main program."""
    answer = 0

    start = time.time()
    max_period = 0
    for index in tqdm.trange(1, 1000):
        period = calculate_period_length(index)
        if period > max_period:
            max_period = period
            answer = index
    end = time.time()
    print("The answer is %d" % answer)
    print("%f seconds elapsed" % (end - start))

    start = time.time()
    max_period = 0
    for index in tqdm.trange(1, 1000):
        period = lambda_decimal_period(index)
        if period > max_period:
            max_period = period
            answer = index
    end = time.time()
    print("The answer is %d" % answer)
    print("%f seconds elapsed" % (end - start))

    import pyperclip
    pyperclip.copy(str(answer))
    print("The answer has been placed in the clipboard.")
开发者ID:jramaswami,项目名称:euler,代码行数:29,代码来源:problem026.py


示例6: main

def main():
    """Main program."""
    answer = 0

    start_time = time.time()

    index = 1
    while True:
        index += 2
        if sympy.ntheory.primetest.isprime(index):
            continue
        conjecture = False
        prev_prime = sympy.ntheory.generate.prevprime(index)
        while prev_prime > 2:
            if math.sqrt((index - prev_prime) / 2).is_integer():
                conjecture = True
                break
            prev_prime = sympy.ntheory.generate.prevprime(prev_prime)

        if not conjecture:
            answer = index
            break

    end_time = time.time()
    print("The answer is %d" % answer)
    print("%f seconds elapsed." % (end_time - start_time))

    import pyperclip
    pyperclip.copy(str(answer))
    print("The answer has been placed in the clipboard.")
开发者ID:jramaswami,项目名称:euler,代码行数:30,代码来源:problem046.py


示例7: episode_get_mcn_and_ref

def episode_get_mcn_and_ref():
    # get mcn
    mcn = pyperclip.copy('na')
    pya.moveTo(424, 474, duration=0.1)
    pya.dragTo(346, 474, duration=0.1)
    pya.hotkey('ctrl', 'c')
    mcn = pyperclip.paste()
    pya.moveTo(424, 474, duration=0.1)
    pya.click(button='right')
    pya.moveTo(481, 268, duration=0.1)
    pya.click()
    
    mcn = pyperclip.paste()
    mcn = mcn.replace(' ', '')
    # get ref
    ref = pyperclip.copy('na')
    pya.moveTo(500, 475, duration=0.1)
    pya.dragRel(-8, 0, duration=0.1)
    pya.hotkey('ctrl', 'c')
    ref = pyperclip.paste()
    pya.moveRel(8, 0, duration=0.1)
    pya.click(button='right')
    pya.moveTo(577, 274, duration=0.1)
    pya.click()
    
    ref = pyperclip.paste()
    return mcn, ref
开发者ID:varnell-holdings,项目名称:new_billing,代码行数:27,代码来源:login_and_run.py


示例8: buscar_campo_id

def buscar_campo_id():
    msg = ''
    pyautogui.PAUSE = 0.5
    pyautogui.FAILSAFE = False
    pyperclip.copy('')
    
    dondeEstaElCampoID = pyautogui.locateOnScreen('operator-id-field.png')
    if dondeEstaElCampoID is None:
        msg = 'El campo de OPERATOR-ID no fue encontrado'
        return (False, msg)
        
    else:
        campoIDPos = list(dondeEstaElCampoID)
        #print campoIDPos
         
    centrocampoID = pyautogui.center(campoIDPos)     
    #print centrocampoID
    pyautogui.moveTo(centrocampoID)
    pyautogui.click(None,None,2)
    pyautogui.typewrite('operador1')
    pyautogui.press('enter')
    pyautogui.press('enter')
    pyautogui.press('enter')
    
    
    
    return (True, msg)
开发者ID:josem-m,项目名称:dena,代码行数:27,代码来源:main_find_pass-oct-21-15-original.py


示例9: buscar_campo_serial

def buscar_campo_serial(serial_number):
    msg = ''
    pyautogui.PAUSE = 0.5
    pyautogui.FAILSAFE = False
    pyperclip.copy('')
    
    dondeEstaElCampoSerial = pyautogui.locateOnScreen('operator-id-field.png')
    if dondeEstaElCampoSerial is None:
        msg = 'El campo de SERIAL NUMBER no fue encontrado'
        return (False, msg)
        
    else:
        campoSerialPos = list(dondeEstaElCampoSerial)
        #print campoSerialPos
         
    centrocampoSerial = pyautogui.center(campoSerialPos)     
    #print centrocampoSerial
    pyautogui.moveTo(centrocampoSerial)
    pyautogui.click(None,None,2)
    #pyautogui.typewrite('C3WB4E768226230')
    pyautogui.typewrite(serial_number)
    pyautogui.press('enter')
    #pyautogui.press('enter')
    #pyautogui.press('enter')
    
    return (True, msg)
开发者ID:josem-m,项目名称:dena,代码行数:26,代码来源:main_find_pass-oct-21-15-original.py


示例10: copy

def copy():
    try:
        if isLoggedIn() == False:
                return "User Not Logged In.",200
        out = ""
        uuid = request.form['uuid']
        attribute = request.form['attribute']
        account = None

        for record in sessionVault.getVault().records:
                if str(record._get_uuid()) == str(uuid):
                    account = record
                    break
        
        if account is None:
            return "No Account Found With That UUID.", 200

        if attribute == "username":
            out = str(account._get_user())
        elif attribute == "password":
            out = str(account._get_passwd())
        elif attribute == "url":
            out = str(account._get_url())
        else:
            return "Invalid attribute.", 200
        
        pyperclip.copy(out)
        return str(out)
    except Exception,e:
        return str(e),500
开发者ID:7h0m4s,项目名称:Primate,代码行数:30,代码来源:server.py


示例11: exit

def exit(msg=''):
    if copied:
        pyperclip.copy('')
    if msg:
        print(color('\n%s' % msg, Fore.RED))
    print(color('\nExiting securely... You are advised to close this terminal.', Fore.RED))
    raise SystemExit
开发者ID:libeclipse,项目名称:visionary,代码行数:7,代码来源:__init__.py


示例12: main

def main(message=None, key=None, mode=None):
    if message == None:
        message = input("Enter a message: ")

    if key == None:
        key = int(input("Enter a key: "))

    if mode == None:
        mode = int(input("Encrypt (1) or Decrypt (0)? : "))

    LETTERS = '[email protected]#$%^&*()-=_+<>[]{},./?;:"\'\\|`~'

    translated = ''

    for symbol in message:
        if symbol in LETTERS:
            num = LETTERS.find(symbol)
            if mode:
                num = (num + key) % len(LETTERS)
            else:
                num = (num - key) % len(LETTERS)

            translated += LETTERS[num]
        else:
            translated += symbol

    print(translated)
    pyperclip.copy(translated)
开发者ID:zach-king,项目名称:Python-Miscellaneous,代码行数:28,代码来源:caesarCipher.py


示例13: _connect

    def _connect(self,kwargs,get_access_token=False):        
        # Get your app key and secret from the Dropbox developer website
        app_key = '150v6du4vixr2xn'
        app_secret = 'yrtlnqjflfvslor'

        if get_access_token:
            flow = dropbox.client.DropboxOAuth2FlowNoRedirect(app_key, app_secret)
            authorize_url = flow.start()

            # Have the user sign in and authorize this token
            authorize_url = flow.start()
            print ('1. Go to: \n%s' % authorize_url)
            print ('2. Click "Allow" (you might have to log in first)')
            print ('3. Copy the authorization code.')
            if kwargs['copy2clipboard']:
                import pyperclip
                pyperclip.copy(authorize_url)
                # spam = pyperclip.paste()

            try: 
                if kwargs['copy2clipboard']:
                    print("Authorization url is copied to clipboard")
                code = raw_input("Enter the authorization code here: ").strip()
            except Exception as e:
                print('Error using raw_input() - trying input()')
                code = input("Enter the authorization code here: ").strip()
            # This will fail if the user enters an invalid authorization code
            access_token, user_id = flow.finish(code)
        else:
            access_token = 'UCdViiUkgIkAAAAAAAAj4q5KsVyvlEgCLV3eDcJJtuLniMmXfnQ6Pj6qNHy1vBHH'

        client = dropbox.client.DropboxClient(access_token)
        print('linked account user: %s' % client.account_info()['display_name'])
        # print 'linked account: ', client.account_info()
        return client
开发者ID:sergeimoiseev,项目名称:egrixcalc,代码行数:35,代码来源:dropboxm.py


示例14: search

def search(): # search database
    db = authentication()
    label = raw_input("Enter the label for your password (ex. \"gmail\"): ")
    query = "select password from sites where label=?"
    found_pass = db.execute(query, (label,)) # searching records
    print "Password copied to your clipboard!"
    pyperclip.copy(found_pass.fetchone()[0])
开发者ID:CD0x23,项目名称:ouvre-toi,代码行数:7,代码来源:ouvre.py


示例15: main

def main():
    # Calculate the number of keys that the current MAX_KEY_DIGITS and
    # MAX_KEY_NUMBER values will cause the hacker program to go through.
    possibleKeys = 0 # start the number of keys at 0.
    for i in range(1, MAX_KEY_DIGITS + 1):
        # To find the total number of possible keys, add the total number
        # of keys for 1-digit keys, 2-digit keys, and so on up to
        # MAX_KEY_DIGITS-digit keys.
        # To find the number of keys with i digits in them, multiply the
        # range of numbers (that is, MAX_KEY_NUMBER) by itself i times.
        # That is, we find MAX_KEY_NUMBER to the ith power.
        possibleKeys += MAX_KEY_NUMBER ** i

    # After exiting the loop, the value in possibleKeys is the total number
    # of keys for MAX_KEY_NUMBER and MAX_KEY_RANGE.
    print('Max key number: %s' % MAX_KEY_NUMBER)
    print('Max key length: %s' % MAX_KEY_DIGITS)
    print('Possible keys to try: %s' % (possibleKeys))
    print()

    # Python programs can be stopped at any time by pressing Ctrl-C (on
    # Windows) or Ctrl-D (on Mac and Linux)
    print('(Press Ctrl-C or Ctrl-D to quit at any time.)')
    print('Hacking...')

    brokenMessage = hackNull(myMessage)

    if brokenMessage != None:
        print('Copying broken message to clipboard:')
        print(brokenMessage)
        pyperclip.copy(brokenMessage)
    else:
        print('Failed to hack encryption.')
开发者ID:AliSharifi,项目名称:codebreaker,代码行数:33,代码来源:nullHacker.py


示例16: add

def add(fullname, password, comment, force, copy):
    db = Database(config.path)
    try:
        login, name = split_fullname(fullname)
    except ValueError:
        message = 'invalid fullname syntax'
        raise click.ClickException(click.style(message, fg='yellow'))

    found = db.get((where("login") == login) & (where("name") == name))
    if force or not found:
        with Cryptor(config.path) as cryptor:
            encrypted = cryptor.encrypt(password)

        credential = dict(fullname=fullname,
                          name=name,
                          login=login,
                          password=encrypted,
                          comment=comment,
                          modified=datetime.now())
        db.insert(credential)
        if copy:
            pyperclip.copy(password)
    else:
        message = "Credential {} already exists. --force to overwrite".format(
            fullname)
        raise click.ClickException(click.style(message, fg='yellow'))
开发者ID:drewdown99,项目名称:passpie,代码行数:26,代码来源:cli.py


示例17: _connect

    def _connect(self, kwargs):
        # Get your app key and secret from the Dropbox developer website
        app_key = "lf7drg20ucmhiga"
        app_secret = "1uf7e8o5eu2pqe9"

        flow = dropbox.client.DropboxOAuth2FlowNoRedirect(app_key, app_secret)
        authorize_url = flow.start()

        # Have the user sign in and authorize this token
        authorize_url = flow.start()
        print("1. Go to: \n%s" % authorize_url)
        print('2. Click "Allow" (you might have to log in first)')
        print("3. Copy the authorization code.")
        if kwargs["copy2clipboard"]:
            import pyperclip

            pyperclip.copy(authorize_url)
            # spam = pyperclip.paste()

        try:
            if kwargs["copy2clipboard"]:
                print("Authorization url is copied to clipboard")
            code = raw_input("Enter the authorization code here: ").strip()
        except Exception as e:
            print("Error using raw_input() - trying input()")
            code = input("Enter the authorization code here: ").strip()
        # This will fail if the user enters an invalid authorization code
        access_token, user_id = flow.finish(code)

        client = dropbox.client.DropboxClient(access_token)
        print("linked account user: %s" % client.account_info()["display_name"])
        # print 'linked account: ', client.account_info()
        return client
开发者ID:sergeimoiseev,项目名称:othodi,代码行数:33,代码来源:dropboxm.py


示例18: main

def main():
    # As a convenience to the user, we will calculate the number of keys that the current MAX_KEY_LENGTH and MAX_KEY_NUMBER settings will cause the breaker program to go through.
    possibleKeys = 0 # start the number of keys at 0.
    for i in range(1, MAX_KEY_LENGTH + 1):
        # In order to find the total number of possible keys, we need to add the total number of keys of 1 number, of 2 numbers, of 3 numbers, and so on up to MAX_KEY_LENGTH numbers.
        # To find the number of keys with i numbers in them, we multiply the range of numbers (that is, MAX_KEY_NUMBER) by itself i times. That is, we find MAX_KEY_NUMBER to the ith power.
        possibleKeys += MAX_KEY_NUMBER ** i

    # After exiting the loop, the value in possibleKeys is the total number of keys for MAX_KEY_NUMBER and MAX_KEY_RANGE. We then print this data to the user.
    print('Max key number: %s' % MAX_KEY_NUMBER)
    print('Max key length: %s' % MAX_KEY_LENGTH)
    print('Possible keys to try: %s' % (possibleKeys))
    print()

    # Python programs can be stopped at any time by pressing Ctrl-C (on Windows) or Ctrl-D (on Mac and Linux)
    print('(Press Ctrl-C or Ctrl-D to quit at any time.)')
    print('Breaking...')

    # The breakNull() function will have all the encryption breaking code in it, and return the original plaintext.
    brokenMessage = breakNull(myMessage)

    if brokenMessage == None:
        # breakNull() will return the None value if it was unable to break the encryption.
        print('Breaking failed. Unable to break this ciphertext.')
    else:
        # The plaintext is displayed on the screen. For the convenience of the user, we copy the text of the code to the clipboard.
        print('Copying broken message to clipboard:')
        print(brokenMessage)
        pyperclip.copy(brokenMessage)
开发者ID:Hiromi-nee,项目名称:codebreaker,代码行数:29,代码来源:nullBreaker.py


示例19: address_scrape

def address_scrape():
    dob = pyperclip.copy('na')
    pya.moveTo(600, 175, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    dob = pyperclip.paste()
    
    street = pyperclip.copy('na')
    pya.moveTo(500, 240, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    street = pyperclip.paste()
    
    suburb = pyperclip.copy('na')
    pya.moveTo(330, 285, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    suburb = pyperclip.paste()
    
    postcode = pyperclip.copy('na')
    pya.moveTo(474, 285, duration=0.1)
    pya.dragTo(450, 285, duration=0.1)
    pya.moveTo(474, 285, duration=0.1)
    pya.click(button='right')
    pya.moveRel(55, 65)
    pya.click()
    postcode = pyperclip.paste()

    address = street + ' ' + suburb + ' ' + postcode

    return (address, dob)
开发者ID:varnell-holdings,项目名称:new_billing,代码行数:34,代码来源:login_and_run.py


示例20: copy_to_clipboard

def copy_to_clipboard(text):
    """
    Copy text to the X clipboard.

    text ::: string to copy to the X keyboard.
    """
    pyperclip.copy(text)
开发者ID:kramer314,项目名称:pass,代码行数:7,代码来源:clipboard.py



注:本文中的pyperclip.copy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pyperclip.paste函数代码示例发布时间:2022-05-27
下一篇:
Python common.generate_msg函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap