Using an '&' in a string in python
<p>What is the purpose of the '&amp;' in the string in this line?</p>

<pre><code>exitAction = QtGui.QAction(QtGui.QIcon('exit.png'), '&amp;Exit', self)
</code></pre>

<p>Likewise here:</p>

<pre><code>fileMenu = menubar.addMenu('&amp;File')
</code></pre>

<p>The <code>&amp;</code> character has a special purpose if you use it in the text of a <code>QAction</code> object: If the QAction object is used in a tool button, the character directly after the <code>&amp;</code> symbol can be used as a keyboard shortcut for that button (in combination with the alt-key).</p>

<p>See <a href="http://doc.qt.io/qt-5/qaction.html" rel="nofollow">http://doc.qt.io/qt-5/qaction.html</a> (resp. <a href="http://doc.qt.io/qt-5/qaction.html#QAction-2" rel="nofollow">http://doc.qt.io/qt-5/qaction.html#QAction-2</a>).</p>

python qt pyqt pyside