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 中命名一个新文件


- 使用 Cython 将 Python 链接到共享库 2022-01-01
- 如何使用PYSPARK从Spark获得批次行 2022-01-01
- CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01
- 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01
- 我如何透明地重定向一个Python导入? 2022-01-01
- YouTube API v3 返回截断的观看记录 2022-01-01
- 计算测试数量的Python单元测试 2022-01-01
- 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
- ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
- 我如何卸载 PyTorch? 2022-01-01