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

2024-07-07 02:47:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我只是刚刚开始我认为将是一个漫长的旅程探索世界的应用在Google App Engine使用Python

我刚刚从the Python official website下载了Python 2.6.4并将其安装到我的计算机上(我使用的是Windows XP)。我还下载了the App Engine Python software development kit (SDK)(从this page)并安装了它。这两个步骤都是在the second page of Google App Engine's Getting-Started Guide上建议的。

然而,当我转到the third page, which is titled as "Hello, World!"时,我遇到了一种复杂的情况。上面写着:

"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..."

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


Tags: 文件thepytxtappgooglepage世界
3条回答

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

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

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

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

相关问题 更多 >