listing19-2.py
来自「《Beginning Python--From Novice to Profes」· Python 代码 · 共 21 行
PY
21 行
from ConfigParser import ConfigParserCONFIGFILE = "python.txt"config = ConfigParser()# Read the configuration file:config.read(CONFIGFILE)# Print out an initial greeting;# 'messages' is the section to look in:print config.get('messages', 'greeting')# Read in the radius, using a question from the config file:radius = input(config.get('messages', 'question') + ' ')# Print a result message from the config file;# end with a comma to stay on same line:print config.get('messages', 'result_message'),# getfloat() converts the config value to a float:print config.getfloat('numbers', 'pi') * radius**2
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?