abc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> tp = ([1],[2],) | |
>>> tp[0] += [3,4] | |
Traceback (most recent call last): | |
File "<pyshell#11>", line 1, in <module> | |
tp[0] += [3,4] | |
TypeError: 'tuple' object does not support item assignment | |
>>> tp | |
([1, 3, 4], [2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lxml.html import fromstring | |
h = fromstring(open('/home/ddd/Hacker School.html').read()) | |
links = set(h.xpath('//a[contains(@href, "github")]')) | |
for x in links: | |
t = x.attrib.get('href').rstrip('/') | |
if not t.endswith('.com'): | |
print t+'.atom' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?><opml version="1.1"><head> <title>Generated by FeedShow OMPLBuilder: Fri, 08 Jun 2012 17:49:24 +0200</title> <dateCreated>Fri, 08 Jun 2012 17:49:24 +0200</dateCreated></head><body><outline text="Main Folder"><outline title="github.com/brendannee.atom" text="github.com/brendannee.atom" type="rss" xmlUrl="http://github.com/brendannee.atom" /> | |
<outline title="github.com/fiveplusone.atom" text="github.com/fiveplusone.atom" type="rss" xmlUrl="http://github.com/fiveplusone.atom" /> | |
<outline title="github.com/j2labs.atom" text="github.com/j2labs.atom" type="rss" xmlUrl="http://github.com/j2labs.atom" /> | |
<outline title="github.com/jconnolly.atom" text="github.com/jconnolly.atom" type="rss" xmlUrl="http://github.com/jconnolly.atom" /> | |
<outline title="github.com/talos.atom" text="github.com/talos.atom" type="rss" xmlUrl="http://github.com/talos.atom" /> | |
<outline title="github.com/shirmung.atom" text="github.com/shirmung.atom" type="rss" xmlUrl="http://github.com/shirmung.atom" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lxml.html import fromstring | |
h = fromstring(open('/home/ddd/Hacker School.html').read()) | |
links = set(h.xpath('//a[contains(@href, "github")]/@href')) | |
for x in links: | |
t = x.rstrip('/') | |
if not t.endswith('.com'): | |
print t+'.atom' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def a(): | |
try: | |
return | |
finally: | |
print 'will always print' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if x: | |
return 1 | |
return 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import datetime | |
import requests | |
import dateutil.parser | |
from BeautifulSoup import BeautifulSoup | |
import time | |
import datetime | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def call_me_maybe(decorator): | |
def inside(*args, **kwargs): | |
if len(args) == 1 and len(kwargs) == 0 and callable(args[0]): | |
return decorator(args[0]) | |
def decorate(actual_function): | |
return decorator(actual_function, *args, **kwargs) | |
return decorate | |
return inside |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a | |
b |
OlderNewer