summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2014-10-15 22:42:43 +0200
committeremkael <emkael@tlen.pl>2014-10-15 22:42:43 +0200
commit4882862ead982dc885187c0cbf9ab3128f2b67bb (patch)
treea8c3239cfc4e1f8bc6d89e293c4b664277284810
parenta6812fff6a67ec83bf9e8b711f7659412cd95269 (diff)
* os.path.join in helper scripts
-rwxr-xr-xdumps/second-a-lap.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/dumps/second-a-lap.py b/dumps/second-a-lap.py
index 771677a..867d7d3 100755
--- a/dumps/second-a-lap.py
+++ b/dumps/second-a-lap.py
@@ -28,10 +28,10 @@ def fetch(url):
for table in tables:
name = "".join(x for x in title if x.isalnum()) + '-' + str(i)
print name
- path = open('second-a-lap/' + name + '.txt', 'w')
+ path = open(os.path.join('second-a-lap', name + '.txt'), 'w')
table = etree.tostring(table)
print >>path, table
- csv_file = csv.writer(open('second-a-lap/csv/' + name + '.csv', 'w'))
+ csv_file = csv.writer(open(os.path.join('second-a-lap', 'csv', name + '.csv'), 'w'))
soup = BeautifulSoup(table)
for row in soup.find_all('tr'):
row = map(lambda t: re.sub('\s+', ' ', " ".join(t.stripped_strings)).encode('utf-8'), row.find_all(re.compile('t[dh]')))