Indentation is important in Python code. Period. (This is really a big, emphatic, bright period.)
Python programmers who move their code from machine to machine prefer to use “spaces as tab characters” over “normal tab characters” for indentation in their code. There is a good reason why they do that.
If you code in Vim, like I do, you might have noticed that the default behaviour of the tab character is to insert as many tab characters, when you press the tab key, as are defined in the .vimrc file. If you want to change Vim to insert spaces instead, add the following into your .vimrc file (I am assuming a tab width of 8 characters):
I picked this up from here.
This announcement comes in way too late.
Earlier this month, I released version 0.2 of slackperm. slackperm is now almost complete. It can, now, also commit the changes required to fix the errant permissions on the filesystem. It has, however, not been thoroughly tested.
If there is something I have come to hate more than most of the things I hate, it is being friends with people who fall down quickly to grab your feet when they are in need, convince and assure you that if you need anything, you need only ask of them, and turn colours faster than a chameleon when you try to approach them when you are actually in need of something they can help you with (however small the need be).
I hate it. I hate it. I hate it like some comparison of hatred that I can’t think of and that has no parallel (this makes it contradictory, but what the hell).
Oh, yeah, this is a small Python script to grab comments from the source of a webpage.
from sgmllib import SGMLParser
"Extract comments from webpage."
self.comments = 
def handle_comment(self, text):
"""Push comments into the comments list."""
self.comments.append("%(text)s" % locals())
"""Returned parsed comments as raw text."""
if __name__ == "__main__":
host = sys.argv
host = 'http://ayaz.pk/'
w = urllib.urlopen(host)
print "The webapge '%s' cannot be retrieved." % host
comment_parser = CommentParser()
Sometime last to last year I picked up Python. I studied it for a day, and feeling overwhelmed by my love for Perl, I ditched it the next day. I won’t tell you why (yeah, it’s a secret, unless someone comes along merrily who knows the secret and comments about it), but I picked up Dive Into Python, admittedly a great book to learn Python, last week. I’ve been reading it like anything ever since. And, although still nothing more than self-proclaiming, I can safely claim I know a lot of Python (I swear, for a moment there, I was typing Perl) now. And that is a good thing.
Enough of beating around the bush. I wrote a small python script, using xml.dom.minidom, to grab titles and links of posts from wordpress blog feeds. The script is available here. It can be used either as a standalone script or imported as a module from, say, the Python interactive shell. A brief example demonstrating its use:
>>> import gettitlesfromwordpress
>>> a = gettitlesfromwordpress.get_title_link(‘https://ayaz.wordpress.com/feed/’)
The “get_title_link()” module can take anything for a URL, a wordpress feed file on hard-disk, to a wordpress feed as a string.