|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- import os
- from easygui import*
- #-----------------------------------------------------------------------
- # create "settings", a persistent Settings object
- # Note that the "filename" argument is required.
- # The directory for the persistent file must already exist.
- #-----------------------------------------------------------------------
- settingsFilename = os.path.join("C:", "Users\fengx\Desktop\python", "settings.txt") # Windows example
- settings = Settings(settingsFilename)
- # we initialize the "user" and "server" variables
- # In a real application, we'd probably have the user enter them via enterbox
- user = "奥巴马"
- server = "白宫"
- # we save the variables as attributes of the "settings" object
- settings.userId = user
- settings.targetServer = server
- settings.store() # persist the settings
- # run code that gets a new value for userId
- # then persist the settings with the new value
- user = "小甲鱼"
- settings.userId = user
- settings.store()
复制代码 |
|