我来测试一下。
hello world
'''
Created on Jul 29, 2011
@author: Chris
'''
print 'db'
person = 'muxitu';
fn = person + '.txt'
surl = 'http://site.douban.com/' + person + '/'
from urllib import urlretrieve
urlretrieve(surl, fn)
import re
pattern = re.compile(r'\s[\W\w\s]*(http:[\W\w]+.mp3)')
patternMN = re.compile(r'[\W\w\s]*/+([\w\W]+.mp3)')
f = file(fn)
# if no mode is specified, 'r'ead mode is assumed by default
while True:
line = f.readline()
if len(line) == 0: # Zero length indicates EOF
break
match = pattern.match(line)
if match:
musicURL = match.group(1)
print musicURL
matchMN = patternMN.match(musicURL)
if matchMN:
print matchMN.group(1)
urlretrieve(musicURL, './' + person + '_music/' + matchMN.group(1))
f.close()
1万+

被折叠的 条评论
为什么被折叠?



