【发布时间】:2018-02-15 07:04:07
【问题描述】:
我正在开发一个 python 程序,我需要通过以下方式在终端中输入一个 hastag:
[delta@localhost Desktop]$ python CheckHastag.py #football
执行后会抛出错误 IndexError: 列表索引超出范围
这是因为python不接受以“#”开头的字符串,但是我尝试不使用#,即
[delta@localhost Desktop]$ python CheckHastag.py football
它有效。
那么如何让我的程序接受主题标签,即字符串开始
用#?
【问题讨论】:
标签: python bash shell command-line command-line-arguments