Chào mọi người, em có cấu trúc thư mục như sau
/source
---- /abc
---- ---- testio.py
---- /data
Hiện tại, em đang thực hiện khi file ở /source/abc/testio.py. Bây giờ, em muốn lưu file sang thư mục khác là /source/data. Em search Google nãy giờ vẫn báo lỗi thế này.
IOError: [Errno 2] No such file or directory: '../data/reviews.csv'
Đây là code hiện tại của em.
import csv
outputFile = './' + str(time.time()) + '-amazon-reviews.csv'
with open(self.outputFile, 'ab') as fp:
file = csv.writer(fp, delimiter = ',',quoting=csv.QUOTE_MINIMAL)
data = [
str(author.text.encode('utf8')),
str(rating.text[:3]),
str(date.text[3:]),
str(content.text.encode('utf8'))
]
file.writerow(data)
Mong mọi người giúp đỡ.