读取来自DrRacket命令行参数 [英] Read in command line arguments from DrRacket

查看:186
本文介绍了读取来自DrRacket命令行参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何检测一下命令行参数时,脚本与运行球拍给出在哪里?也就是说,sys.argv中的Python中相当于ARGS []在Java中,等...

How do I detect what command line arguments where given when a script is run with racket? That is, the equivalent of sys.argv in Python, args[] in Java, etc...

推荐答案

您有这些选择(你可以找到它们的文档获取更多信息):

You have these choices (you can look them all up in the docs for more info):


  • 电流命令行参数 - 矢量持有命令行参数

  • current-command-line-arguments -- a vector holding the command line arguments

您可以开始与 -m 标记的脚本,这将需要的文件,并寻找一个提供功能,那么它适用于命令行参数(字符串列表)

You can start a script with the -m flag, which will require the file and look for a provided main function, then apply it on the command-line arguments (as a list of strings)

或者,你可以要求球拍/ CMDLINE 它提供了可用于方便的方法来定义多个标志的宏。

Or you can require racket/cmdline which provides a macro that can be used to define several flags in a convenient way.

这篇关于读取来自DrRacket命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆