Concatenating numerical and string attributes
dont bother
dontbotherworld at yahoo.com
Fri Mar 12 04:26:14 EST 2004
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 youre looking for faster
http://search.yahoo.com
More information about the Python-list
mailing list