简体   繁体   English

在 PyCharm 中打开 a.py 文件是否有害/恶意?

[英]Can opening a .py file in PyCharm be harmful/malicious?

I've just started learning Python and have downloaded PyCharm and understand this is likely to be a very basic question but wanted to ask before I set off with a false sense of security.我刚刚开始学习 Python 并下载了 PyCharm 并理解这可能是一个非常基本的问题,但在我带着错误的安全感出发之前想问一下。

I'm interested to know whether:我有兴趣知道是否:

a) Simply opening but not running a .py file as a project in PyCharm IDE could be malicious. a) 在 PyCharm IDE 中简单地打开但不运行.py文件作为项目可能是恶意的。

b) Opening and running a .py file in the PyCharm IDE can be malicious b) 打开并运行 PyCharm IDE 中的.py文件可能是恶意的

If not either, why not?如果不是,为什么不呢? Would the file need to be a.exe to do anything without PyCharm being involved?该文件是否需要是 a.exe 才能在不涉及 PyCharm 的情况下执行任何操作?

Again, appreciate any help/insight you can provide.再次感谢您提供的任何帮助/见解。

So just opening a file in PyCharm will not harm any computer in any way.因此,仅在 PyCharm 中打开文件不会以任何方式损害任何计算机。
But running code can do that, so I would be careful were you get the code which you want to execute.但是运行代码可以做到这一点,所以如果你得到你想要执行的代码,我会小心的。 And it would be best if you understood the basic of the code you are running.如果您了解您正在运行的代码的基本知识,那将是最好的。 Therefore you would be able to spot strange lines in your code.因此,您将能够在代码中发现奇怪的行。

A Python source file (like any other programming language) is just a plain text file, so until the instructions that are written in the file are evaluated (by the python interpreter in this case) the file itself cannot be in any way harmful. Python 源文件(与任何其他编程语言一样)只是一个纯文本文件,因此在评估写入文件中的指令之前(在这种情况下由python 解释器)文件本身不会以任何方式有害。 Only once you run python myfile.py in a shell or by using an IDE like PyCharm the code is actually executed... at that point what happens depends on what is written in the file (which you can check before executing it). Only once you run python myfile.py in a shell or by using an IDE like PyCharm the code is actually executed... at that point what happens depends on what is written in the file (which you can check before executing it).

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

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