简体   繁体   English

将 csv 文件从桌面导入 Pycharm(在 Mac 上)

[英]Import a csv file from desktop into Pycharm (on Mac)

I have trouble importing a csv file from my desktop into my Project folder in Pycharm.我无法将 csv 文件从桌面导入 Pycharm 中的项目文件夹。 I would like to have this csv file in the same directory inside Pycharm.我想将这个 csv 文件放在 Pycharm 内的同一目录中。

I tried PyCharm->Project Structure->+Add content root, but it's not working.我尝试了 PyCharm->Project Structure->+Add content root,但它不起作用。

Any ideas?有任何想法吗? Thank you谢谢

You can just copy and paste the csv file into the desired folder within the PyCharm project navigation window.您只需将 csv 文件复制并粘贴到 PyCharm 项目导航窗口中的所需文件夹中即可。 Then you can use this code to open the file:然后您可以使用此代码打开文件:

file = open("path to file here", "r")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM