Python 官方文档:入门教程 => 点击学习
#!/usr/bin/python # -*- coding:utf-8 -*- import ConfigParser config = ConfigParser.ConfigParser() config.read(
#!/usr/bin/python
# -*- coding:utf-8 -*-
import ConfigParser
config = ConfigParser.ConfigParser()
config.read("flashfxp.ini")
sections = config.sections()
print sections
options = config.options("CmdWindow")
print options
items = config.items("CmdWindow")
print items
context1 = config.get("main","optdata")
print context1
context2 = config.get("LiveUpdate","Interval")
print context2
-----------------------------------------flashfxp.ini----------------------------
[main]
optdata=eJwzMTAxMODlMgFSpmDKCEqZQSgLMGViyMsFAI+xBn4=
build=1240
setup=40400
FileExists=000000000
QHistoryMax=50
Options=1001000010000010011010011111111000000101111101110000000010000000000100110010011041100000000210010111111113001111010100
[LiveUpdate]
Interval=15
[QuickConnect]
Left=0
Top=0
Width=424
Height=260
State=0
[Graph]
V=0
H=65
[window]
Left=124
Top=69
Width=1093
Height=614
State=0
TS=0.5
BS=0.5
CS=0.75
LTS=0
RTS=0
THP=546
[CmdWindow]
Y=0.629999995231628
W=454
H=377
[statuswin]
Left=383
Top=154
Width=592
Height=411
State=0
Font="宋体", 8, [], [clWindowText], 134
Color=-2147483643
OnTop=0
Wrap=0
-----------------------------------------the result-------------------------
['LiveUpdate', 'CmdWindow', 'Graph', 'window', 'QuickConnect', 'main', 'statuswin']
['y', 'w', 'h']
[('y', '0.629999995231628'), ('w', '454'), ('h', '377')]
eJwzMTAxMODlMgFSpmDKCEqZQSgLMGViyMsFAI+xBn4=
15
--结束END--
本文标题: Python利用ConfigParser
本文链接: https://lsjlt.com/news/186773.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0