<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>imaizumimr</author_name>
  <author_url>https://blog.hatena.ne.jp/imaizumimr/</author_url>
  <blog_title>Eggshell</blog_title>
  <blog_url>https://imaizumimr.hatenablog.com/</blog_url>
  <categories>
    <anon>Python</anon>
    <anon>競技プログラミング</anon>
  </categories>
  <description>=は参照渡しになるため、別々のリストとして変更したいときにうまくいかない。 A = [1, 2, 3] B = A A[0] = 100 print(A, B) # [100, 2, 3] [100, 2, 3] こういうときは浅いコピーか深いコピーを使って別のオブジェクトを作成する。 浅いコピー 1次元リストの場合はsliceを使うと短く書ける。 A = [1, 2, 3] B = A[:] A[0] = 100 print(A, B) # [100, 2, 3] [1, 2, 3] copyも使える。 import copy A = [1, 2, 3] B = copy.copy(A) A…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fimaizumimr.hatenablog.com%2Fentry%2F2020%2F05%2F14%2F160455&quot; title=&quot;Pythonでリストをコピーする - Eggshell&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2020-05-14 16:04:55</published>
  <title>Pythonでリストをコピーする</title>
  <type>rich</type>
  <url>https://imaizumimr.hatenablog.com/entry/2020/05/14/160455</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
