By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,265 Members | 1,710 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,265 IT Pros & Developers. It's quick & easy.

Concatenating numerical and string attributes

P: n/a
Hey,
I have these attributes:

index[i]
which is a numerical value value

vector[i]
which is a numerical float value

and I want to concatenate like this:

featurevector = string(1)+ " " + string(index[i]) +
":" +string(vector[i])
However, when I run my program I get this error:

$Traceback (most recent call last):
File "try.py", line 70, in ?
featurevector=string(index[i])+string(vector[i])
TypeError: 'module' object is not callable
What I have to do is this:

I have to write this feature vector which occurs in
computation of some loop to a file. The file has to be
in append more since I have to separate various
feature vectors by space.

For example the I have to write like this:

1 10:0.2304 20:0.2804 30:0.567

I have these values 10:0.2304, 20:0.2804, 30:0.567
coming from a loop where I compute index them as
index, value pair. i.e. the tuple is index[i],
vector[i].
I was trying to do this by concatenating 1 and then
subsequent strings. However, I have this error.
Can some one point me how to do this, though seems to
be simple, but I am ignorant. Note that I need to
write 1 only once, in the starting.
Thanks A Ton to this list,
Dont

__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Fri, 12 Mar 2004 01:26:14 -0800 (PST),
dont bother <do*************@yahoo.com> wrote:
featurevector = string(1)+ " " + string(index[i]) +
":" +string(vector[i])
However, when I run my program I get this error: $Traceback (most recent call last):
File "try.py", line 70, in ?
featurevector=string(index[i])+string(vector[i])
TypeError: 'module' object is not callable


"string" is a module.

"str" is a type.

HTH,
Heather

--
Heather Coppersmith
That's not right; that's not even wrong. -- Wolfgang Pauli
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.