Simple Problem: Getting rid of {}

dont bother dontbotherworld at yahoo.com
Fri Mar 12 21:39:48 CET 2004


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(vector[i])+" "
                print feature_element
        else:
                    
feature_element=str(index[i])+":"+str(vector[i])+" "

       
feature_vector=str(feature_element)+str(feature_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.0291806958474
1 22389:0.0291806958474 {}



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
http://search.yahoo.com




More information about the Python-list mailing list