selfteaching / selfteaching/selfteaching-python-camp
Day10 如何处理jieba库cut函数的返回值
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 151
- Forks
- 875
- PR merge metrics
- No merged PRs in 30d
Description
cut函数的文档并没有标注其返回值,搜索引擎搜索之后发现其返回值是一个“生成器”(一脸懵逼)
处理cut函数返回值的方法如下:
import jieba
text='今天天气真好,我要出去跑步'
print(','.join(jieba.cut(text)))
输出结果为:
今天天气,真,好,,,我要,出去,跑步
可见print函数中的逗号','是分隔分词的
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the repository for the documentation entry for jieba.cut and read the surrounding explanation and examples. Document that cut returns a generator and clarify how the shown Python example consumes it; done means the return value and usage are clear to readers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100