python去list的括号

如题所述

第1个回答  2013-11-04
Hey guei,
I think now I know what you want
You mus thave a function like this

def func(*args, **argv):
......

So now, you can pass however much parameters to it.
What if you don't know have many you are gonna have when calling it?
Well, you need a list (or dict) and have to unpack it.
Just do like this:

aList = ['param1', 'param2', .... 'paramn']

func(*aList)

See, pretty easy, '*' is for unpacking in python.

Have fun

Old answer:
If you directly print a list , then the brackets are always there.
Normaly, you can print the content of a list like this

for i in aList:
print i,
print

This will print all the content with a space seperating them.本回答被提问者采纳
第2个回答  2013-10-30
给点例子,不是很明白你的意思
相似回答