diff --git a/coursework/royal institute computer science masterclass 2021/computer science and social media/twitter.py b/coursework/royal institute computer science masterclass 2021/computer science and social media/twitter.py index 0651639..27a433a 100644 --- a/coursework/royal institute computer science masterclass 2021/computer science and social media/twitter.py +++ b/coursework/royal institute computer science masterclass 2021/computer science and social media/twitter.py @@ -1,11 +1,13 @@ import csv +import os class Account: def __init__(self, csvfile): self.handle = csvfile[:-4] self.bio = '' 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) first_row = 1 for row in reader: @@ -30,4 +32,4 @@ class Tweet: self.text = tweet[0] self.likes = int(tweet[1]) self.retweets = int(tweet[2]) - self.date_time = tweet[3] \ No newline at end of file + self.date_time = tweet[3]