<b>REGISTER</b>

GFX-Sector - Scripte & Downloads


 
GFX-Sector » Coding Area » Scripte & Downloads » [Python3] Simple Configuration Parser » Hello Guest [Login|Register]
Last Post | First Unread Post Print Page | Recommend to a Friend | Add Thread to Favorites

Scripte & Downloads

Du hast ein tolles Script gefunden oder geschrieben und möchtest es mit uns teilen? Hier ist der richtige Ort dazu.
Post New Thread Post Reply

[Python3] Simple Configuration Parser

     Deutsche Version  English version
Author
Post « Previous Thread | Next Thread »

quantum quantum is a male
Pfadfinder

Spender


Avatar von quantum

Registration Date: 29.12.2008
Posts: 721
Deviantart: xcracx

Spacer
[Python3] Simple Configuration Parser

[Python3] Simple Configuration Parser

      

Hier mal eins meiner kleinen Module.

Eigentlich recht nützlich, da es nicht so "fett" wie die built-in Module ist. Simpel halt.

Download:
http://script.pcriot.com/dl/Config.py

Paste:
http://pastebin.revalc.de/view.php?ID=112

Beschreibung/Anleitung:
Die Konfigurationsdatei sollte wie folgt aufgebaut sein:
code:
1:
2:
key:value

(Leerzeichen sind irrelevant)

Kommentare werden mit einer Raute (#) eingeleitet.

Achtung:
Der Key darf keinen Doppelpunkt enthalten!


Beispiel:
rc.conf:
code:
1:
2:
3:
4:
# Directions
articles_dir: articles
static_pages_dir: pages
templates_dir: templates


code:
1:
2:
3:
from Config import Config

cfg = Config('rc.conf')


Nun gibt es zwei Wege, auf den Wert eines Schlüssels zuzugreifen:
code:
1:
cfg.values['articles_dir']

oder:
code:
1:
cfg.getvalue('articles_dir')


So einfach ist das Wink

Sollte es irgendetwas geben, was euch stört, wo ihr Hilfe benötigt oder sonstiges, sagt einfach bescheid Wink

lg


This post has been edited 2 time(s), it was last edited by quantum: 12.06.2010 13:45.

[Python3] Simple Configuration Parser 12.06.2010 03:53 quantum is offline Homepage of quantum Search for Posts by quantum
 
Spacer
   
GFX-Sector
unregistered


 hat kein Avatar


Spacer

Have you enjoyed this topic?


If you were enjoying this post and if you keen on reading more interesting stuff then do not hesitate to complete the free sign up.

After the free registration you will gain access to all areas and you will be able to communicate with other artists from all over the world.

In addition you will benefit from our Photoshop and coding section as well as from our huge (hundreds of gigabytes) free resource section where you can find everything you will need to be a successful (web) designer/artist.

Sign up now and enjoy the advantages as a registered member.

(This website will be ad-free after a complete free sign up.)

New Post 12.06.2010 03:53  
Tree Structure | Board Structure
Post New Thread Post Reply
GFX-Sector » Coding Area » Scripte & Downloads » [Python3] Simple Configuration Parser

Similar topics to [Python3] Simple Configuration Parser
Thread
[Dienstleistung] Code für simples Design (Forum: Archiv)
Simple Homepage - >3000€ ?! (Forum: Allgemeine Diskussion)
Simple Effect Header (Forum: Webdesign/Interface)
simple sig (Forum: Signaturen/Avatare)
New Simple Webdesign (Forum: Designs)