首页 > 其他 > 详细

command-line arguments _ golang

时间:2015-03-31 14:23:22      阅读:226      评论:0      收藏:0      [点我收藏+]

Command-line arguments are a common way to parameterize execution of programs. For example, go run hello.go uses run and hello.go arguments to the go program

package main

import (
    "fmt"
    "os"
)

func main() {

    argsWithProg := os.Args
    argsWithoutProg := os.Args[1:]

    arg := os.Args[3]

    fmt.Println(argsWithProg)
    fmt.Println(argsWithoutProg)
    fmt.Println(arg)
}
[./commonLineArgument a b c d]
[a b c d]
c

总结 : 

  1 : ....

command-line arguments _ golang

原文:http://www.cnblogs.com/jackkiexu/p/4380606.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!