Naming a new file in PyCharm(在 PyCharm 中命名一个新文件)
问题描述
我刚开始学习python.到目前为止,我主要使用 jupyter 笔记本,但现在想尝试一些 IDE.所以我尝试了 PyCharm.
所以我开始在一个项目中创建一些文件并开始尝试命令和东西,有一件事情让我发疯,因为我似乎找不到答案.
每次我创建一个新的 python 文件并将其命名为simple_message"时,它只是保存为普通文件,我无法在其中运行任何代码.删除下划线后,文件约定将更改为实际的 python 文件,我可以运行其中编写的代码.所以我认为可能是下划线造成了麻烦,所以我尝试使用下划线创建其他文件,但它们都有效.有人可以启发我,为什么文件名simple_message"不能作为python文件工作?
谢谢!
I just started learning python. Up until now, I primarly worked with jupyter notebooks, but now wanted to try out some IDEs. So I tried out PyCharm.
So I started creating some files in a project and started trying out the commands and stuff and there is one thing which just drives me crazy, cause I can not seem to find an answer.
Everytime I create a new python file and name it something like "simple_message", it just saves as a normal file and I can't run any code in it. As soon as I remove the underscore, the file convention changes to an actual python file and I can run the code written in it. So I thought it might be the underscore that makes trouble, so I tried creating other files with underscores but all of them worked. Can someone enlighten me, why does the file name "simple_message" not work as a python file?
Thank you!
From this To this
Currently PyCharm context menu lets you choose the file type to create. If you choose "file" you MUST provide the extension .py If You choose "Python File" pycharm handles the extension for You.
这篇关于在 PyCharm 中命名一个新文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 PyCharm 中命名一个新文件
基础教程推荐
- 筛选NumPy数组 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01