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 中命名一个新文件
基础教程推荐
- Discord.py 缺少必需的参数 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
