Girish Sahani wrote: > I want to generate all substrings of size k-1 from a string of size k. > e.g 'abcd' should give me ['abc','abd','bcd','acd']
def get_sub_set( s ) : return [s[:i]+s[i+1:] for i in range(len(s))] >>> print get_sub_set( 'abcd' ) ['bcd', 'acd', 'abd', 'abc'] Regards Sreeram
signature.asc
Description: OpenPGP digital signature
-- http://mail.python.org/mailman/listinfo/python-list