声明空集变量的方法 [英] ways to declare empty set variable
问题描述
也许这是一个非常具有初步意义的问题,但我对CSS中的'b $ b''set''和''Set''模块感到有些困惑。
我明白''set''是2.4(或2.3)之后的python中的内置类型和Set a
单独的模块,无论如何,我会在''set'中使用build'' 。
那么问题是如何将空集变量声明为''var = []''
对列表变量做什么?< <
2008年2月12日星期二14:45:43 +0100,Sun写道:
那么问题是如何将一个空集变量声明为''var = []''
对列表变量做什么?
你不能在Python中声明变量。只需创建一个`set`
的实例并将其绑定到一个名称:
var = set()
Ciao,
Marc''BlackJack''Rintsch
2月12日下午3:45,太阳报 < a ... @hut.atwrote:
也许这是一个非常主要的问题,但我对
$ b $感到有些困惑b''设置''和''设置'模块在python中。
我理解''set''是2.4(或2.3)之后的python中的内置类型和Set一个
单独的模块,无论如何,我会在''set''中使用build。
那么问题是如何声明一个空的set变量为a''var = []''
对列表变量做什么?
>> test = set()
test
set([])
< blockquote class =post_quotes>
>> type(test)
< type''set' '>
您正在寻找吗?
" Chris" < cw **** @ gmail.com写信息
新闻:f3 ************************** ******** @ y5g2000h sf.googlegroups.com ...
2月12日下午3:45,太阳报 < a ... @hut.atwrote:
>也许这是一个非常具有初步意义的问题,但我只是有点困惑
关于<在python中使用''set''和''set''模块。
我理解''set''是在2.4(或2.3)和Set
那么问题是如何将空集变量声明为''var =
[]''
对列表变量做什么?
>>> test = set()
test
set([])
>>> type (测试)
< type''set''>
您正在寻找吗?
是的,这就是我想要的,感谢所有人提供的快速答案!
我想知道为什么我不能将格式用作var = {}到var = list()在
设置变量,并决定不打扰它。
谢谢。
Maybe this is a very primative question, but I just get a bit confused about
''set'' and ''Set'' module in python.
I understand ''set'' is a build in type in python after 2.4(or 2.3) and Set a
seperate module, anyhow, I gonna use build in ''set''.
then the question is how can I declare a empty set variable as a ''var= []''
do to a list variable?
On Tue, 12 Feb 2008 14:45:43 +0100, Sun wrote:
then the question is how can I declare a empty set variable as a ''var= []''
do to a list variable?You don''t declare variables in Python. Just create an instance of `set`
and bind it to a name:
var = set()
Ciao,
Marc ''BlackJack'' Rintsch
On Feb 12, 3:45 pm, "Sun" <a...@hut.atwrote:Maybe this is a very primative question, but I just get a bit confused about
''set'' and ''Set'' module in python.
I understand ''set'' is a build in type in python after 2.4(or 2.3) and Set a
seperate module, anyhow, I gonna use build in ''set''.
then the question is how can I declare a empty set variable as a ''var= []''
do to a list variable?
>>test = set()
test
set([])
>>type(test)
<type ''set''>
You looking for that ?
"Chris" <cw****@gmail.comwrote in message
news:f3**********************************@y5g2000h sf.googlegroups.com...On Feb 12, 3:45 pm, "Sun" <a...@hut.atwrote:>Maybe this is a very primative question, but I just get a bit confused
about
''set'' and ''Set'' module in python.
I understand ''set'' is a build in type in python after 2.4(or 2.3) and Set
a
seperate module, anyhow, I gonna use build in ''set''.
then the question is how can I declare a empty set variable as a ''var=
[]''
do to a list variable?
>>>test = set()
test
set([])
>>>type(test)
<type ''set''>
You looking for that ?yeah, that ''s what I am looking for, thanks all for such prompt answers!
I was wondering why can''t I use a format as "var = {} " to "var=list()" in
set variable, and decided not to bother with it.
Thanks.
这篇关于声明空集变量的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!