selfteaching / selfteaching/selfteaching-python-camp
Day05 含ea的单词删除后,输出的是每个单词单独成行,怎么变回原先text格式呢?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 151
- Forks
- 875
- PR merge metrics
- No merged PRs in 30d
Description
Day05 含ea的单词删除后,输出的是每个单词单独成行,怎么变回原先text格式呢?
这是代码:
1. 字符串的基本处理
print(text.replace('better', 'worse')) # better 替换成 worse
text1=text.replace('better', 'worse') # 1.2步后的text, 命名为text1
print(text1.split()) # 用str.split()方法把字符串变成由若干个元素组成的列表
text2=text1.split() # text2为列表
for x in text2:
if 'ea' not in x:
print(str(x)+" ", end='')
print()
这是run后的输出:

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
The issue includes the complete snippet; start by tracing the loop and the indentation of the print() call after the condition. Run the snippet and confirm that the words without “ea” are rendered in the intended text format rather than each on a separate line.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100