Windows7中双击py文件运行程序

最近看了一本python方面的教材,洋洋洒洒写了好几页,也没将要点讲到,我现将在Window7下,双击py文件运行程序的方法总结如下&#xff1

最近看了一本python方面的教材,洋洋洒洒写了好几页,也没将要点讲到,我现将在Window7下,双击py文件运行程序的方法总结如下:

方法

将该文件的Properties设置为如下:

注意:别忘了在py文件中的最后加入input(“Enter the any press to exit” )这行代码。这种方法仅仅限于在Windows系统下使用,方便查看自己的运行结果。

举例

比如,我写了如下代码:

# Instructions
# Demonstraction programmer - created functions

def instructions():
    """Display game instructions"""
    print(
    """
    Welcome to the greatest intellectual challenge of all time: Tic-Tac-Toe.
    This will be a showdown between your human brain and my sillicon processor.

    You will make you move known by entering a number, 0-8. The number
    will correspond to the board position as illustrated:
                    0 | 1 | 2
                    ---------
                    3 | 4 | 5
                    ---------
                    6 | 7 | 8
    Prepare your self, human. The ultimate battle is about to begin.\n"""
    )

# main

print("Here are the instructions to the Tic-Tac-Toe:")
instructions()
input("\n\nPress the enter key to exit.")

双击该文件后,出现界面如下:

发布者:admin,转转请注明出处:http://www.yc00.com/web/1732785303a3643291.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信