python - VS Code 中的 Python genfromtxt 找不到 txt
问题描述
我正在尝试使用 Visual Code 读取与我的 python 执行目录位于同一文件夹中的 .txt 文件。但是,Visual Code 根本找不到该文件。我已经用命令 os.getcwd() 检查了我与 .txt 文件在同一目录中,但是,程序出现以下错误:
Exception has occurred: OSError
t43_2_rl1_str_Idvg_Vds_4_IV0.txt not found.
File "/home/User/Desktop/Directory/Trans/L_VT_I_CTE.py", line 5, in lecture
data = np.genfromtxt(name,dtype='float')
如果我打印os.getcws
,我会得到:
/home/User/Desktop/Directory
那是同一个目录...我尝试更改launch.json,包括cwd,但是没有用...即使尝试在ubuntu终端中执行该文件,我也遇到了同样的错误...
我究竟做错了什么?
谢谢!!
解决方案
我发现了我的错误......我只是添加了更改文件名"Trans/t43_2_rl1_str_Idvg_Vds_4_IV0.txt"
,它确实有效!
谢谢你=)
推荐阅读
- javascript - Vue搜索过滤器复选框问题
- javascript - 将数据 (d3) 投影到传单地图上的问题
- javascript - 如何获得类型化反应组件属性的代码完成?
- linux - apache linux中的ldap身份验证
- powerbi - 使用 Spark odbc 连接器从 Azure 数据工厂连接到 Databricks 表时出现问题
- amazon-web-services - AWS 上的串行 COM 端口
- excel - SumIF 使用表/命名范围而不是单个单元格条件
- vba - Outlook.Mailitem 未能被另一个子调用
- android - 当我使用带有位图或可绘制位图的滑动时,应用程序在添加第 4 个连续图像时不断崩溃
- javascript - SPA 调用 CORS 禁用的 api