Fix twitter.py to read new directories
This commit is contained in:
parent
6c48925bc5
commit
a354d88ee5
1 changed files with 4 additions and 2 deletions
|
@ -1,11 +1,13 @@
|
||||||
import csv
|
import csv
|
||||||
|
import os
|
||||||
|
|
||||||
class Account:
|
class Account:
|
||||||
def __init__(self, csvfile):
|
def __init__(self, csvfile):
|
||||||
self.handle = csvfile[:-4]
|
self.handle = csvfile[:-4]
|
||||||
self.bio = ''
|
self.bio = ''
|
||||||
self._tweets = []
|
self._tweets = []
|
||||||
with open(csvfile, 'r',encoding='utf-8') as file:
|
filePath = '{0}/{1}'.format(os.path.dirname(os.path.realpath(__file__)), csvfile)
|
||||||
|
with open(filePath, 'r',encoding='utf-8') as file:
|
||||||
reader = csv.reader(file)
|
reader = csv.reader(file)
|
||||||
first_row = 1
|
first_row = 1
|
||||||
for row in reader:
|
for row in reader:
|
||||||
|
@ -30,4 +32,4 @@ class Tweet:
|
||||||
self.text = tweet[0]
|
self.text = tweet[0]
|
||||||
self.likes = int(tweet[1])
|
self.likes = int(tweet[1])
|
||||||
self.retweets = int(tweet[2])
|
self.retweets = int(tweet[2])
|
||||||
self.date_time = tweet[3]
|
self.date_time = tweet[3]
|
||||||
|
|
Loading…
Reference in a new issue