【问题标题】:Create a tutorial in python 3在 python 3 中创建教程
【发布时间】:2018-12-29 05:52:02
【问题描述】:

我正在尝试创建一个终端 python 程序。我想在用户第一次启动程序时为他们添加一个教程,然后再打开它。有什么办法可以做到这一点,还是我必须为它创建一个单独的脚本?

【问题讨论】:

    标签: python python-3.x terminal


    【解决方案1】:

    有很多方法可以做到这一点。您可以在程序第一次启动时简单地创建一个文件。

    first_time=False
    fn='config.txt'
    try:
        file = open(fn, 'r')
    except IOError:
        file = open(fn, 'w')
        first_time=True
    if(first_time):
        print("This is the first time")
        #you tutorial code can go here
    

    【讨论】:

      猜你喜欢
      • 2012-03-14
      • 2013-07-25
      • 1970-01-01
      • 1970-01-01
      • 2011-09-13
      • 2018-08-19
      • 2010-10-31
      • 1970-01-01
      • 2012-04-22
      相关资源
      最近更新 更多