sigizmund.com
Currently viewing the tag: "python"
A URL matching regex in Python — any problems?
By sigizmund On January 17, 2010 · 19Leave a Commenthttp%3A%2F%2Fsigizmund.com%2Fa-url-matching-regex-in-python-%25e2%2580%2594-any-problems%2FA+URL+matching+regex+in+Python+%E2%80%94+any+problems%3F2010-01-17+11%3A20%3A21sigizmundhttp%3A%2F%2Fsigizmund.wordpress.com%2F2010%2F01%2F17%2Fa-url-matching-regex-in-python-%25e2%2580%2594-any-problems
Can anyone see any flaws in it for real-world URL?
>>> str = 'and now http://sub.domain.com/something/?here3=3ab&what=1#where=1 that was a URL'
>>> urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&#+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', str)
>>> urls
['http://sub.domain.com/something/?here3=3ab&what=1#where=1']
For me it looks like working but you never now… Comments from @HD42 [...]flickrpy + 30 lines of code = poor man's Flickr Backup solution
By sigizmund On January 15, 2010 · 235 Commentshttp%3A%2F%2Fsigizmund.com%2Fflickrpy-30-lines-of-code-poor-mans-flickr-backup-solution%2Fflickrpy+%2B+30+lines+of+code+%3D+poor+man%26%23039%3Bs+Flickr+Backup+solution2010-01-15+12%3A11%3A00sigizmundhttp%3A%2F%2Fsigizmund.wordpress.com%2F2010%2F01%2F15%2Fflickrpy-30-lines-of-code-poor-mans-flickr-backup-solution
It uses somewhat buggy but excellent flickrpy module by James Clarke — works well for me after some small adjustments:
def main(): flickr.API_KEY = constants.API_KEY flickr.API_SECRET = constants.API_SECRET u = flickr.User(id = ’92002612@N00′) sets = u.getPhotosets() for ps in sets: name = ps.title name = name.replace(‘”‘, “‘”).replace(“/”, “_”) folderName = “/Users/kirillov/Pictures/Flickr/%s” % name [...]
-
Categories
-
Calendar
February 2012 M T W T F S S « Jun 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 -
Meta
