469,936 Members | 2,444 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,936 developers. It's quick & easy.

Concatenating numerical and string attributes

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
1 1865
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.

Similar topics

20 posts views Thread by Brian Kazian | last post: by
1 post views Thread by Pol Bawin | last post: by
8 posts views Thread by farah727rash | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.