Giter Club home page Giter Club logo

load-yaml-for-python's Introduction

load-yaml-for-python

pythonでymlファイルにi18nextみたく変数を置きたかったので作った

Instance arguments

  • dir_name => ymlファイルを格納している一番親のディレクトリ
  • extension => ファイルの拡張子(もちろん default="yml")
  • dir_symbol => ymlファイルの上階層にディレクトリがある場合に使用するシンボル(default=":")

Method arguments

  • path => ymlファイル内の変数までのパス(例を参考に)
  • attribute_symbol => ymlファイル内の変数に別変数を代入する際に使用するシンボル(default="@")

使い方と例

フォルダ階層

  • yml
    • test.yml(test: hello)
    • Foo
      • bar.yml(test: good)
  1. クラスのインスタンスを作成 yml = YamlConverte("yml")

  2. yamlメゾットに以下のようにパスを指定。親ディレクトリがある場合はFoo:のように指定

  • get[test.yml in test] (no parent directory)
    • yml.yaml("test.test")
  • get[bar.yml in test] (exist parent directory)
    • yml.yaml("Foo:bar.test")

あれ値が返ってこない(None)

  • 指定している親ディレクトリの名前が違うか、同じものがある可能性
  • ファイルのパスが間違っている
  • シンボル記号が間違っている など

load-yaml-for-python's People

Contributors

yuya-okabe avatar okabe-yuya avatar

Stargazers

 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.