@SebastianNielsen Not knowing Selenium does not help but it looks like a dictionary might be more efficient than what you have at the moment. I know you mention performance wise but I would go for the most efficient and to me that is a dictionary
You seem quite set on what you have currently and I would say that is fine. It's down to personal preference as well
Well in my case it is pretty much about personal preference as the function will only be run a minimal ammount of times. But you are right in that I properly should consider the dictionary approach if the function were to be run multiple times in order to avoid overhead.
Goodnight guys and thank you for your time Simon, it is very much appreciated.
I don't know, my goal was to give direction, I think I achieved that. Currently my brain is out of processing capacity (even though less productive day) :/
I'm running this script as I'm trying to start a ssh server based on python. Found some script here and there.
from pexpect import pxssh
conn = pxssh.pxssh()
if not conn.login ('127.0.0.1', 'toto', 'tata'):
print("SSH session failed on login.")
print(str(conn))
else:
print("SSH session login successful")
conn.sendline ('ls -l')
conn.prompt() # match the prompt
print(conn.before) # print everything before the prompt.
conn.logout()
@jjj (highly biased opinion since I've been playing for >9 years) Yes, it's the best MMORPG out there. Regular tournaments with biggest prize pools in the history of online gaming.
@AndyK easy on the swears, please, that's a little outside of normal for the Python room. Or maybe not, depending on how you define normal...
Building a community is hard, I created my own Finance meetup, 2 others rsvp'd for the first meetup and both didn't show, I'm currently at my second one, nobody else RSVPd... :/
But at least I'm hanging out with a Python buddy...
See, I can hang out with you guys from the comfort of my living room couch or even my bed. But with a real-live meetup, I get the benefit of packing up, getting on the subway, sitting on a bench that has had God-knows-what on it, with no wifi, then getting to the building and hoping we're not going to have any problems actually getting in... then sitting awkwardly on a bench at the work-share place wondering if someone's going to actually rsvp at the last minute,
or if it's just going to be me and the guy who's letting us use the space...
Since it's interactive, you should fire up a python shell and try for yourself! A good place to start can be the official docs or some 3rd party interactive tutorial, like learnpython.org
@Rick no, that's a dictionary in python. objects are bit different.
When the keys are simple strings, it is sometimes easier to specify pairs using keyword arguments:
>>> dict(sape=4139, guido=4127, jack=4098)
{'sape': 4139, 'jack': 4098, 'guido': 4127}
It's an imperative language, not functional. And as usual in OOP, the relationship between functions and classes is that functions turn into methods if they're defined in a class. The __init__ method is the constructor.
Hmm, I wonder how many people are currently trying their best to resist the urge to "well, actually" me
Let me add this disclaimer: Everything I say may or may not be slightly simplified to make it easier to understand and more appropriate for the beginner level