当前位置: 首页 > news >正文

甘肃做网站的公司有哪些网站建设与管理个人职业生涯规划书

甘肃做网站的公司有哪些,网站建设与管理个人职业生涯规划书,网页制作相关网站,新网站注册文章目录 对比INIJSONYAMLXMLTOML参考文献 对比 格式优点缺点是否支持注释INI简单易懂语言内置支持不支持复杂数据结构✓JSON支持复杂数据结构阅读起来不够直观YAML简洁有序支持复杂数据结构灵活但有歧义不同实现有兼容性问题✓XML支持复杂数据结构和命名空间语法冗长体积较大…

文章目录

  • 对比
  • INI
  • JSON
  • YAML
  • XML
  • TOML
  • 参考文献

对比

格式优点缺点是否支持注释
INI简单易懂
语言内置支持
不支持复杂数据结构
JSON支持复杂数据结构阅读起来不够直观×
YAML简洁有序
支持复杂数据结构
灵活但有歧义
不同实现有兼容性问题
XML支持复杂数据结构和命名空间语法冗长体积较大
TOML语法简洁
支持复杂数据结构
相对较新




INI

键值分隔符为 =:

注释符为 #;

缺乏统一的标准,不能表示复杂数据结构,常用于 Windows 程序

config.ini

[Simple Values]
key=value
spaces in keys=allowed
spaces in values=allowed as well
spaces around the delimiter = obviously
you can also use : to delimit keys from values[All Values Are Strings]
values like this: 1000000
or this: 3.14159265359
are they treated as numbers? : no
integers, floats and booleans are held as: strings
can use the API to get converted values directly: true[Multiline Values]
chorus: I'm a lumberjack, and I'm okayI sleep all night and I work all day[No Values]
key_without_value
empty string value here =[You can use comments]
# like this
; or this# By default only in an empty line.
# Inline comments can be harmful because they prevent users
# from using the delimiting characters as parts of values.
# That being said, this can be customized.[Sections Can Be Indented]can_values_be_as_well = Truedoes_that_mean_anything_special = Falsepurpose = formatting for readabilitymultiline_values = arehandled just fine aslong as they are indenteddeeper than the first lineof a value# Did I mention we can indent comments, too?
import configparserconfig = configparser.ConfigParser(allow_no_value=True)
config.read('config.ini', encoding='utf-8')for section in config.sections():print(section)for key, value in config.items(section):print('  {} = {}'.format(key, value))

特殊字符如 % 会报错 configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%xxxx'

可以用 %% 或者 config.get('MYSQL', 'PASSWORD', raw=True)




JSON

常用于 JavaScript、Python、Node.js、Ruby

config.json

{"mysql": {"host": "127.0.0.1","user": "root","password": "123456","port": 3306,"database": "mysql"}
}
import jsonconfig = json.load(open('config.json'))
print(config)




YAML

YAML 官网

注释符为 #

常用于 Python、Java、Go 等

config.yaml

language: python
mysql:host: localhostport: 3306username: userpassword: secretfields:- id- name- age

安装

pip install PyYAML
import yamlconfig = yaml.safe_load(open('config.yaml', 'r', encoding='utf-8'))
print(config)




XML

注释符为 <!-- 结合 -->

常用于 Java、C#、.NET、Scala 等

<config><database><host>localhost</host><port>3306</port><username>user</username><password>secret</password></database>
</config>
import xml.etree.ElementTree as ETtree = ET.parse('config.xml')
root = tree.getroot()
config = {}
for child in root:config[child.tag] = {subchild.tag: subchild.text for subchild in child}
print(config)




TOML

注释符为 #

常用于 Python、Rust、Go 等

config.toml

# This is a TOML documenttitle = "TOML Example"[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00-08:00[database]
enabled = true
ports = [ 8000, 8001, 8002 ]
data = [ ["delta", "phi"], [3.14] ]
temp_targets = { cpu = 79.5, case = 72.0 }[servers][servers.alpha]
ip = "10.0.0.1"
role = "frontend"[servers.beta]
ip = "10.0.0.2"
role = "backend"

Python 3.11 标准库开始有 tomllib

import tomllibconfig = tomllib.load(open('config.toml', 'rb'))
print(config)

其余版本使用 toml

pip install toml
import tomlconfig = toml.load(open('config.toml', 'r'))
print(config)




参考文献

  1. configparser — Python 文档
  2. json — Python 文档
  3. PyYAML Documentation
  4. xml.etree.ElementTree — Python 文档
  5. tomllib — Python 文档
  6. 常见配置文件格式
  7. 给力!Python配置文件,这一篇就够了!
http://www.yayakq.cn/news/82347/

相关文章:

  • 教做美食的网站wordpress 采集微博
  • 网站被百度k是什么意思如何用wd做网站设计
  • wordpress建的网站吗有没有免费做英语题的网站
  • 网站建设技术员分为前端 后端域名上面怎么建设网站
  • 网站建设硬件要求常州创新优典网站建设
  • 公司给别人做的网站违法吗怎么选择郑州网站建设
  • 新丰县建设局网站wordpress的PC端和移动端
  • 做网站的总是有活动怎么回事购买保险的网站
  • 西宁做网站的网站上设置多语言怎么做
  • 做电商网站前端的技术选型是湖南省疾控中心
  • 网站地址栏图标文字wordpress去除底部
  • 莘县住房建设局网站秦皇岛网站排名
  • 网站展示型推广百度关键词seo排名优化
  • 做网站编辑需要什么文凭做网站_没内容
  • 德州极速网站建设小程序网站欢迎页面怎么做
  • 网站建设 广州佛山安装wordpress前出现500 错误
  • 群站wordpresswordpress 小众软件 主题
  • 推广的网站需要备案吗迅睿cms和帝国哪个好
  • 苏州企业如何建站四川建设厅官方网站证书查询
  • 企业网站关键词排名做网站的书籍
  • 营销型网站和普通网站的区别怎么制作手机软件
  • 个人主页网站申请天天联盟没网站怎么做
  • 中国电力建设集团公司网站3liang 设计网站 源码
  • supercell账号注册网站page to wordpress
  • 关于公路建设的网站创作图片的软件
  • 专业网站优化软件表白软件制作器手机版
  • 怎么做网站端口代理国外开发网站
  • 湘潭网站设计外包服务创建网站费用
  • 驻马店住房和城乡建设部网站昆明做网站seo
  • 医疗网站建设机构用什么软件做商务网站