Nginx 配置文件解析器 python-nginx

码农软件 · 软件分类 · XML相关工具 · 2019-09-17 16:12:25

软件介绍

python-nginx , Nginx 配置文件解析器。

用法示例:

#!/usr/bin/env python
# encoding: utf-8

from parser import Parser
from config import Config

# just 4 test
if "__main__" == __name__:
    # 配置文件路径
    path = r'./default'

    # 结构化后的配置内容
    data = Parser().loadf(path)
    # print data

    # 对配置内容的操作通过 config 实例
    config = Config(path)

    # 一些操作示例
    # print config.find(('upstream', 'http')).toggle('server', '8000').gen_config()
    # print config.find('http', 'server').append("addtional", "string").remove("additional", "string").gen_config()

    # 保存配置内容至制定文件
    # config.savef(r'./default.result')

本文地址:https://codercto.com/soft/d/14805.html

The Haskell School of Expression

The Haskell School of Expression

Paul Hudak / Cambridge University Press / 2000-01 / USD 95.00

Functional programming is a style of programming that emphasizes the use of functions (in contrast to object-oriented programming, which emphasizes the use of objects). It has become popular in recen......一起来看看 《The Haskell School of Expression》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器