如何为 Google App Engine 创建 .py 文件?
我刚刚开始探索 Google App 中的应用程序世界,这将是一段漫长的旅程使用 Python 的引擎。
我刚刚下载了 Python 2.6.4从 Python 官方网站 并将其安装到我的计算机上(我正在使用Windows XP)。我还下载了 App Engine Python 软件开发工具包 (SDK)(来自 < a href="http://code.google.com/appengine/downloads.html" rel="nofollow noreferrer">此页面)并安装了它。 Google App Engine 入门的第二页建议了这两个步骤 -启动指南。
不过,当我转到第三页时,标题为“你好,世界!”,我遇到了一些麻烦。那里写着:
“创建一个名为 helloworld.txt 的目录。 该应用程序的所有文件都驻留在 在此目录中。里面的 helloworld目录下,创建一个文件 命名为 helloworld.py,并为其指定 以下内容...”
我在这里有点困惑:如何创建 .py 文件?是不是我需要创建一个记事本文件(.txt)并将其命名为 helloworld.py (当我这样做时,它没有不会更改为任何不同的文件,而是保留普通的 .txt 文件)或者我应该使用我安装的 Google App Engine Launcher 创建该文件吗?
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 Engine using Python.
I have just downloaded Python 2.6.4 from the Python official website and 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.
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..."
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
下载并安装 Python 时,您还安装了 IDLE。您可以使用它轻松编写、运行、调试和保存带有语法突出显示的 .py 文件。首先,只需打开 IDLE,然后选择
File ->新窗口
。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
..py 文件是包含 Python 语法的文本文件。使用您最喜欢的编程编辑器,甚至记事本。
关于第二个问题,Windows 资源管理器中有一个关于隐藏文件扩展名的选项。确保它未被选中 - 您实际上很可能已将文件重命名为 helloworld.py.txt 但只看到了 helloworld.py
A .py file is a text file containing Python syntax. Use your favourite programming editor, or even NotePad.
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
您将需要一个比记事本更好的编辑器。使用记事本,使用“另存为...”,然后在对话框中键入“helloworld.py”,包括引号,以便文件扩展名是 .py 而不是 .txt
You will need a better editor than Notepad. With Notepad, use Save As..., and type "helloworld.py" in the dialog, including quotes so that the file extension is .py instead of .txt
我不在 Windows 上,但这就是它在其他操作系统上的工作方式:使用编辑器创建文件,然后另存为 ...
ps。
.py
是扩展名(如.docx
、.bat
,...),但这只是一个约定(尽管强烈推荐一)..pps。听说 http://www.e-texteditor.com/ 比记事本有更多功能..
I'm not on windows, but thats how it works on other operating systems: Create a file with an editor, then save as ...
ps. and
.py
is the extension (like.docx
,.bat
, ...), but it's just a convention (although a highly recommended one) ..pps. heard the http://www.e-texteditor.com/ has more capabilities than notepad ..
您必须注意,结尾表示识别文件,而不是内容。将文件命名为
.py
只是向用户(和 GUI)提示它很可能是一个 python 文件。话虽这么说,Python 文件只是文本文件。您只需使用记事本(或您选择的编辑器)创建一个文本文件,并将结尾重命名为
.py
并从那里开始工作。大多数现代编辑器还会根据文件结尾突出显示语法。You have to be aware that the ending signifies recognition of files, not content. Name a file
.py
simply hints to the user (and the GUI) that it most likely is a python file.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
.py
and work from there. Most modern editors will also highlight the syntax based on file endings.