selfteaching / selfteaching/selfteaching-python-camp

Day05 含ea的单词删除后,输出的是每个单词单独成行,怎么变回原先text格式呢?

Open
#4,133 2 comments 0 reactions 0 assignees View on GitHub

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后的输出:
image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.