LoginSignup
1
1

More than 5 years have passed since last update.

はじめてのPython ではまったこと

Last updated at Posted at 2015-11-14

python を使い始めて、はまったところを書いていきます。

参照渡し

x=['a','b','c']

y=x

ここで、y は、['a', 'b', 'c'] です。

でも、

x[0]="xxx" をいれて、x を、['xxx', 'b', 'c'] にします。そうすると、
yも、['xxx', 'b', 'c']  になります。'a' の部分が、'xxx' になってしまいます。

気をつけましょう。

1
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1