selfteaching / selfteaching/selfteaching-python-camp

Day05 学习困惑:字符串是不可变容器,为什么可以用str.replace()替换里面的元素?

Open
#1,953 3 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

我在网上搜了这个问题:看到有回答说“str.replace()不会改变原字符串”,这句话怎么理解?在程序上“替换”是不是有特定的意思?

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

Start by reviewing the Day05 lesson and the question about string immutability and str.replace(). Identify where this concept is explained, then make the explanation clear enough to distinguish replacement from modifying the original string; done means the learner’s stated confusion is directly addressed.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.