Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

json-to-cmd-params.py 283 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
  1. #!/usr/bin/env python
  2. import json
  3. import sys
  4. json_file, = sys.argv[1:]
  5. with open(json_file, 'r') as f:
  6. json_dict = json.load(f)
  7. cmd_str = ' '.join([f'--{k}' if v is True else ('' if (v is False or v is None) else f'--{k} {v}') for k, v in json_dict.items()])
  8. print(cmd_str)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...