[Bf-python] svg2obj script.
Campbell Barton
cbarton at metavr.com
Wed Mar 28 17:58:20 CEST 2007
jmsoler at free.fr wrote:
> Selon Martin Poirier <theeth at yahoo.com>:
>
>
>> The part that removes redundant spaces can be factored
>> out too.
>>
>> def remSpaces(txt):
>> t1 = txt
>> t2 = txt.replace(" ", " ")
>> while len(t1) != len(t2):
>> t1 = t2
>> t2 = t1.replace(" ", " ")
>>
>
>
>
> And you really believe that the code that you suggest above is
> simpler and faster than :
> while ' ' in t2: t2=t2.replace(' ',' ')
>
> jms
Of course its faster, one less lookup per cycle,
while ' ' in t2: is a lookup
Where martins example just checks that theres always a change in the
string size.
> Cam, does it happen every time or only on specific svg
> files? Also, does it happen without your
> modifications? (just making sure)
The error happened for the 2 svg files I tried to import. both fairly
simple and from inkscape.
More information about the Bf-python
mailing list