Hi,
I have done some string concatenation:
feature_vector= {}
feature_element ={}
#inside a loop
if (v==0):
feature_element =str(1)+"
"+str(index[i])+":"+str(vecto r[i])+" "
print feature_element
else:
feature_element =str(index[i])+":"+str(vecto r[i])+" "
feature_vector= str(feature_ele ment)+str(featu re_vector)
if (v==0):
print feature_vector
when I print feature_vector I get my desired output
but with an extra {} in the end.
Output:
1 22389:0.0291806 958474
1 22389:0.0291806 958474 {}
I fail to understand why this is happening since
feature_element should also have {} in the end, if it
was the case with the variables I declared with like:
syntax{}
How to get rid of this extra {} from my string.
Thanks
Dont
_______________ _______________ ____
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
I have done some string concatenation:
feature_vector= {}
feature_element ={}
#inside a loop
if (v==0):
feature_element =str(1)+"
"+str(index[i])+":"+str(vecto r[i])+" "
print feature_element
else:
feature_element =str(index[i])+":"+str(vecto r[i])+" "
feature_vector= str(feature_ele ment)+str(featu re_vector)
if (v==0):
print feature_vector
when I print feature_vector I get my desired output
but with an extra {} in the end.
Output:
1 22389:0.0291806 958474
1 22389:0.0291806 958474 {}
I fail to understand why this is happening since
feature_element should also have {} in the end, if it
was the case with the variables I declared with like:
syntax{}
How to get rid of this extra {} from my string.
Thanks
Dont
_______________ _______________ ____
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
Comment