python 如何为 Google App Engine 创建 .py 文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1866147/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 23:14:16  来源:igfitidea点击:

How to create a .py file for Google App Engine?

pythongoogle-app-enginefilemakefile

提问by brilliant

I am just at the very start of what I think is gonna be a long journey exploring the world of applications in Google App Engineusing Python.

我认为这将是一段使用PythonGoogle App Engine 中探索应用程序世界的漫长旅程的开始。

I have just downloaded Python 2.6.4from the Python official websiteand installed it on my computer (I am using Windows XP). I also downloaded the App Engine Python software development kit (SDK)(from this page) and installed it, too. Both of these steps were suggested on the second page of Google App Engine's Getting-Started Guide.

我刚刚从Python 官网下载了Python 2.6.4并安装在我的电脑上(我使用的是 Windows XP)。我还下载了 App Engine Python 软件开发工具包 (SDK)(从此页面)并安装了它。这两个步骤均在Google App Engine 的入门指南的第二页中提出。

However, when I moved on to the third page, which is titled as "Hello, World!", I ran into a sort of complication. It is written there:

然而,当我翻到标题为“你好,世界!”的第三页时。,我遇到了一种复杂的情况。那里写着:

"Create a directory named helloworld. All files for this application reside in this directory. Inside the helloworld directory, create a file named helloworld.py, and give it the following contents..."

“创建一个名为 helloworld 的目录。此应用程序的所有文件都位于此目录中。在 helloworld 目录中,创建一个名为 helloworld.py 的文件,并为其提供以下内容...”

I am kind of puzzled here: How do I create a .py file? Is it like I need to create a notepad file (.txt) and name it helloworld.py (when I did so, it didn't change into any different file of any different, but rather stayed an ordinary .txt file) or should I somehow create that file using Google App Engine Launcher that I have installed?

我有点困惑:如何创建 .py 文件?是不是我需要创建一个记事本文件 (.txt) 并将其命名为 helloworld.py(当我这样做时,它没有变成任何不同的文件,而是保持一个普通的 .txt 文件)或者应该我以某种方式使用已安装的 Google App Engine Launcher 创建了该文件?

回答by steadfastbuck

When you downloaded and installed Python, you also installed IDLE. You can use this to easily write, run, debug and save .py files with syntax highlighting. To get started, just open IDLE, and select File -> New Window.

当您下载并安装 Python 时,您还安装了IDLE。您可以使用它轻松编写、运行、调试和保存带有语法突出显示的 .py 文件。要开始,只需打开 IDLE,然后选择File -> New Window

回答by William Billingsley

A .py file is a text file containing Python syntax. Use your favourite programming editor, or even NotePad.

.py 文件是包含 Python 语法的文本文件。使用您最喜欢的编程编辑器,甚至记事本。

Regarding your second problem, there's an option in Windows Explorer about hiding file extensions. Make sure it isn't checked -- you might well actually have renamed your file helloworld.py.txt but only seen helloworld.py

关于您的第二个问题,Windows 资源管理器中有一个关于隐藏文件扩展名的选项。确保它没有被选中——你可能实际上已经重命名了你的文件 helloworld.py.txt 但只看到了 helloworld.py

回答by Christian P.

You have to be aware that the ending signifies recognitionof files, not content. Name a file .pysimply hints to the user (and the GUI) that it most likely is a python file.

您必须知道结尾表示对文件的识别,而不是对内容的识别。命名文件.py只是向用户(和 GUI)提示它很可能是一个 python 文件。

That being said, python files are merely text files. You can simply create a text file with Notepad (or your editor of choice) and rename the ending to .pyand work from there. Most modern editors will also highlight the syntax based on file endings.

话虽如此,python 文件只是文本文件。您可以简单地使用记事本(或您选择的编辑器)创建一个文本文件并将结尾重命名为.py并从那里开始工作。大多数现代编辑器还会突出显示基于文件结尾的语法。

回答by Roy Tang

You will need a better editor than Notepad. With Notepad, use Save As..., and type "helloworld.py" in the dialog, includingquotes so that the file extension is .py instead of .txt

您将需要一个比记事本更好的编辑器。使用记事本,使用另存为...,并在对话框中键入“helloworld.py”,包括引号,以便文件扩展名是 .py 而不是 .txt

回答by miku

I am kind of puzzled here: How do I create a .py file? Is it like I need to create a notepad file (.txt) and name it helloworld.py?

我有点困惑:如何创建 .py 文件?是不是我需要创建一个记事本文件 (.txt) 并将其命名为 helloworld.py?

I'm not on windows, but thats how it works on other operating systems: Create a file with an editor, then save as...

我不在 Windows 上,但这就是它在其他操作系统上的工作方式:使用编辑器创建文件,然后另存为...

ps. and .pyis the extension (like .docx, .bat, ...), but it's just a convention (although a highly recommended one) ..

附:and.py是扩展名(如.docx, .bat, ...),但这只是一个约定(尽管强烈推荐)..

pps. heard the http://www.e-texteditor.com/has more capabilities than notepad ..

pps。听说http://www.e-texteditor.com/比记事本有更多的功能..