📄 listing19-2.py
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -