Post thumbnail of Function arguments optional in python
17 December 2009
Continue reading Function arguments optional in python

Function arguments optional in python

I like it. It’s so simple and flexible. Define it with none, then assign sys.argv in place of argv.

Post thumbnail of Get a reversed list of command line arguments from sys.argv
12 October 2009
Continue reading Get a reversed list of command line arguments from sys.argv

Get a reversed list of command line arguments from sys.argv

This is useful if you need to look at the last arguments before deciding what to do, possibly for interoperability with some older code where the order of command line arguments is already set in stone.

Post thumbnail of What’s the best way to find the hostname in python?
7 October 2009
Continue reading What’s the best way to find the hostname in python?

What’s the best way to find the hostname in python?

Fifty million ways to get the hostname, choose one. But I couldn’t find a way to get the shortname without a system call to ‘hostname -s’. This is the best I could come up with, which would work with any of the above methods.

Powered by Wordpress   |   Lunated designed by ZenVerse