我编写了一个python文件,执行后应在本地目录中创建一个csv文件。即使执行成功完成,python文件也不会在本地目录中创建csv文件。我的代码和输出屏幕截图如下:
SELECT ed.monthNameYear, ed.monthName,
COUNT(*),
SUM(COUNT(*)) OVER (ORDER BY ed.monthNameYear)
FROM (SELECT DATE_FORMAT(`reservation_for`,'%Y-%m') as monthNameYear,
DATE_FORMAT(`reservation_for`, '%M %Y') as monthName,
email,
COUNT(*) AS cnt
FROM `tablename`
GROUP BY email, DATE_FORMAT(`reservation_for`, '%Y-%m'),
DATE_FORMAT(`reservation_for`,'%M %Y')
HAVING COUNT(*) > 1
) ed
GROUP BY ed.monthNameYear, ed.monthName;
答案 0 :(得分:0)
由于当前工作目录(cwd)问题,很有可能将其保存在您不希望的地方。
按照PyCharm current working directory更改PyCharm中的当前工作目录,或使用代码明确更改它:
import os # put these lines at the top of your script
os.chdir(r"/Users/bsulin/PycharmProjects/StockNewsWebScraper/")