Convert gethandles.py to Python 3

Directly output datecsv.sh results
This commit is contained in:
Klaus-Uwe Mitterer 2015-04-13 22:11:42 +02:00
parent cf2e246db1
commit 0c4eb44444
2 changed files with 4 additions and 5 deletions

View file

@ -1,7 +1,6 @@
#!/bin/bash
DATAFILE=Database.db
OUTFILE=output.csv
SQLITE="sqlite3 -csv -header"
@ -13,4 +12,4 @@ done
QUERY="$QUERY FROM tweets t GROUP BY SUBSTR(t.timestamp,0,11);"
$SQLITE $DATAFILE "$QUERY" > $OUTFILE
$SQLITE $DATAFILE "$QUERY"

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import operator, re, sqlite3
@ -23,6 +23,6 @@ def getTweets(database_filename = "Database.db"):
return handles
if __name__ == "__main__":
data = sorted(getTweets().items(), key=operator.itemgetter(1), reverse=True)
data = sorted(list(getTweets().items()), key=operator.itemgetter(1), reverse=True)
for handle, tweets in data:
print handle + "," + str(tweets)
print(handle + "," + str(tweets))