This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: When I assign for a item which list of single item
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: martin.panter, paul.moore, steve.dower, steven.daprano, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2016-08-20 10:17 by anngg2008, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg273201 - (view) Author: ZHY (anngg2008) Date: 2016-08-20 10:17
it seems can't set a value for item which I want to.
msg273202 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-08-20 10:22
Original post:

“When I assign for a item which list of single item, it seems can't set a value for item which I want to.”

See the FAQ entry <https://docs.python.org/3.5/faq/programming.html#how-do-i-create-a-multidimensional-list>. When you multiply a list, each outer item is actually just reference to the same inner list object.
msg273205 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2016-08-20 11:57
For future reference, don't post screen shots. Copy and paste the text of your code and its output. You don't program with Photoshop, you program with a text editor.

Screen shots make it impossible to copy the code, search for the text, and make it difficult or impossible for the blind and visually impaired to contribute.
msg273218 - (view) Author: ZHY (anngg2008) Date: 2016-08-20 15:31
Sorry, it's my mistake. Thanks.
History
Date User Action Args
2022-04-11 14:58:35adminsetgithub: 72000
2016-08-20 15:31:46anngg2008setnosy: - anngg2008
2016-08-20 15:31:22anngg2008setnosy: paul.moore, tim.golden, steven.daprano, martin.panter, zach.ware, steve.dower, anngg2008
messages: + msg273218
2016-08-20 15:29:14anngg2008setfiles: - a.png
2016-08-20 11:57:54steven.dapranosetnosy: + steven.daprano
messages: + msg273205
2016-08-20 10:24:39SilentGhostsetcomponents: + Interpreter Core, - Windows
stage: resolved
2016-08-20 10:22:43martin.pantersetstatus: open -> closed

nosy: + martin.panter
messages: + msg273202

resolution: not a bug
2016-08-20 10:17:00anngg2008create