Creating slice notation from string

Bob van der Poel bob at mellowood.ca
Wed Sep 2 18:57:48 EDT 2009


> Of course, you could also do something like this:
>
>      eval('x' + s)
> or
>      eval(str(x) + s)
>

Yes, I have user inputed 's'. So, if I can't get the generalized list
version from Robert working I'll have to use this. Speed is not a big
deal in this. As to malicious input, I could pretty easily check to
see that all the values are integers.

I tried something like this earlier but could not get it to work.
Didn't think of converting my x[] to a string. Makes sense.

Thanks.




More information about the Python-list mailing list