一个奇怪的list
2018-05-13 本文已影响0人
正哥哥
In [21]: print(inputs)
[<socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.124.129', 1234)>]
In [22]: type(inputs)
Out[22]: list
In [23]: mylist = [<socket.socket fd=12, family=AddressFamily.AF_INET, type=Sock
...: etKind.SOCK_STREAM, proto=0, laddr=('192.168.124.129', 1234)>]
File "<ipython-input-23-9836698e2996>", line 1
mylist = [<socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.124.129', 1234)>]
^
SyntaxError: invalid syntax
In [33]: mylist = inputs
In [34]: print(mylist)
[<socket.socket fd=12, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.124.129', 1234)>]
mylist使用inputs相同的值去赋值报错!但是下面一段引用inputs这个列表却没问题,什么鬼?
暂时搞不清楚什么原因,待后续捣鼓!!!