selfteaching / selfteaching/selfteaching-python-camp
Day05 用for循环加判断条件找出含有ea单词时怎么删除?
Open
Nobody has claimed this yet.
question
- Dominant language
- Python
- Stars
- 151
- Forks
- 875
- PR merge metrics
- No merged PRs in 30d
Description

如图我的代码。
list = text.split( )#将text的字符串以空格为分割符分割成字符串并赋值给变量list
str1 = "ea"
str2=[]
for i in list:
if i.find(str1) > -1:
str2.append(i)
print(list)
我想把找出来的单词塞进一个新的数组,然后把数组全部删掉,怎么删?
还有一个方法是找出来含有ea单词时用remove删除,但是这样会有删除遗漏的问题,如何解决删除不完全的问题?
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
Start from the Python example in the issue body and review how the list is split, searched, and modified during iteration. Check a filtering or deletion approach that avoids skipped matches; done means every word containing “ea” is removed without omissions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100