⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listing19-2.py

📁 《Beginning Python--From Novice to Professional》 的源码
💻 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 + -