Giter Club home page Giter Club logo

Comments (1)

lollipop190 avatar lollipop190 commented on June 27, 2024

来自助教的优质解答!

用户参数是我定义的一个概念,我也没找到它的准确叫法。但是这个用户参数是有存在意义的。
选项是可以带参数也可以不带参数,比如-s就规定没有参数,这个时候arg0和-s没有任何关系。
并且参数的数量也是可以指定的,不一定只有一个,有相关的API可以做到这个事情。
选项如果带有N个参数,那么程序会默认把-*后面的N个字符串当成这个选项的参数,当然这些字符串不能带有“-”,否则会被认为是另一个选项。

用一个好理解的说法就是所有的选项指定了一些和程序相关的属性,而用户参数才是真正程序关注的东西
比如你要吃饭,选项可以更改你使用的餐具,但是用户参数指的是你吃什么,没有用户参数你显然无法完成吃饭这件事,但是你使用的什么餐具对整件事影响很小,它只是一个附带的属性
题目里只不过是没有处理用户参数,并不意味着所有的程序都不需要用户参数

getArgs获取的是全部用户参数
getOptionValue里需要传入某个选项的名字,然后回返回一个string数组,这就是这个选项的所有参数

from 2020se1-faq.

Related Issues (20)

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.