title: How do I programmatically press control and right arrow key in Python?
body: <p>I need to programmatically press the control and the right arrow key simultaneously using the <a href="https://pypi.org/project/keyboard/" rel="nofollow noreferrer">keyboard</a> package.</p>
  <p>I tried</p>
  <pre><code>keyboard.press(&quot;ctrl+right&quot;)
  keyboard.press(&quot;ctrl+\033[C&quot;)
  </code></pre>
  <p>but both result in <code>ValueError</code>:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;C:\Users\User\anaconda3\lib\site-packages\pyHook\HookManager.py&quot;, line 351, in KeyboardSwitch
      return func(event)
    File &quot;test2.py&quot;, line 37, in onKeyboardEvent
      keyboard.press(&quot;ctrl+\033[C&quot;)
    File &quot;C:\Users\User\anaconda3\lib\site-packages\pynput\keyboard\_base.py&quot;, line 362, in press
      resolved = self._resolve(key)
    File &quot;C:\Users\User\anaconda3\lib\site-packages\pynput\keyboard\_base.py&quot;, line 556, in _resolve
      raise ValueError(key)
  ValueError: ctrl+[C
  </code></pre>
  <p>How can I send a <code>Ctrl-Right Arrow</code> keystroke?</p>