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

cmd_kwargs.py 431 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
14
15
16
17
18
19
  1. import sys
  2. def get_cmd_kwargs(start_index=1):
  3. if len(sys.argv) < start_index:
  4. return {}
  5. else:
  6. d = {}
  7. for arg in sys.argv[start_index:]:
  8. k, v = arg.split("=")
  9. try:
  10. v = int(v)
  11. except ValueError:
  12. try:
  13. v = float(v)
  14. except ValueError:
  15. pass
  16. d[k] = v
  17. return d
Tip!

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

Comments

Loading...