由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - python 问题,急,在线等。
相关主题
请教个javascript的问题 (转载)A simple question on Flex
如果python command line positional arguments 里有些是运算,那这种argument 该怎么处理?gdb里怎么call member function
Python: What does this mean?Default function template arguments
How to compare data in an Array and in Xml (转载)ajax小问题
[合集] 我也花了一小时读了一下pythonCalling order of functions as arguments
python: how to use an array as an argumentfunction declaration
请教python里面function的arguments的格式问题c的函数指针能不能弄得像matlab的function handle一样?
static如何作为函数?js: 怎么来监听某个function被call的次数?
相关话题的讨论汇总
话题: function话题: python话题: list2话题: list1话题: def
进入Programming版参与讨论
1 (共1页)
t***q
发帖数: 418
1
python 问题,急,在线等。要用python写一个function,function 有两个arguments,
这两个arguments是两个lists.该怎么写?
def function(list1, list2) not right,
def function(*list1,*list2) not right,
how to do it?
或是python function只容许有一个list argument?
Thank you so much!
l*********s
发帖数: 5409
2
first one shall be ok.
L*****e
发帖数: 8347
3
第一种为啥说not right?

【在 t***q 的大作中提到】
: python 问题,急,在线等。要用python写一个function,function 有两个arguments,
: 这两个arguments是两个lists.该怎么写?
: def function(list1, list2) not right,
: def function(*list1,*list2) not right,
: how to do it?
: 或是python function只容许有一个list argument?
: Thank you so much!

a9
发帖数: 21638
4
how about this?
def function(list1, list2):

【在 t***q 的大作中提到】
: python 问题,急,在线等。要用python写一个function,function 有两个arguments,
: 这两个arguments是两个lists.该怎么写?
: def function(list1, list2) not right,
: def function(*list1,*list2) not right,
: how to do it?
: 或是python function只容许有一个list argument?
: Thank you so much!

a9
发帖数: 21638
5
缺了冒号吧,呵呵

arguments,

【在 L*****e 的大作中提到】
: 第一种为啥说not right?
L*****e
发帖数: 8347
6
呃,那楼主的问题其实应该改改:如何定义一个python function? 呵呵。。。

【在 a9 的大作中提到】
: 缺了冒号吧,呵呵
:
: arguments,

t***q
发帖数: 418
7
多谢大家这么踊跃的回答。我很感激。
我后来找出原因了,def function(list1,list2):即可。
我有error的原因是数据不规整。即数据的列数不一样,就有error: IndexError: list
index out of range
多谢!多谢!
1 (共1页)
进入Programming版参与讨论
相关主题
js: 怎么来监听某个function被call的次数?[合集] 我也花了一小时读了一下python
如何定义 Javascript overload function ?python: how to use an array as an argument
Python:请问如何把list变成structured array。请教python里面function的arguments的格式问题
Python: 有一个混合了子list和string的list, 如何判断元素是list还是string?static如何作为函数?
请教个javascript的问题 (转载)A simple question on Flex
如果python command line positional arguments 里有些是运算,那这种argument 该怎么处理?gdb里怎么call member function
Python: What does this mean?Default function template arguments
How to compare data in an Array and in Xml (转载)ajax小问题
相关话题的讨论汇总
话题: function话题: python话题: list2话题: list1话题: def