Jun-29-2017, 08:44 PM
Next time, when posting your code, trying using the combination "Ctrl + Shift + V" and see if that works.
As to your questions, the second 'pxssh' is an attribute of the class pxssh and is explained here : pxssh doc
The
As to why not make it global? A better question is "Why make it global". Again, Python prefers you use local variables rather than global, if possible. In this case, 's' is only being used locally in the 'connect' function.
As to your questions, the second 'pxssh' is an attribute of the class pxssh and is explained here : pxssh doc
The
s = pxssh.pxssh()
is just a shortcut to save some keystrokes. You will, however, rile up the villagers by using single letter variables such as 's'. Python encourages the use of 'descriptive' names, whether it be variables, functions or classes.As to why not make it global? A better question is "Why make it global". Again, Python prefers you use local variables rather than global, if possible. In this case, 's' is only being used locally in the 'connect' function.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition