How to return an "not string' error in function?

2006-09-21 Thread breakfastea
first of all I have to claim that I'm a noob so please help me don't blame me:) for example: def test(s): if type(s) != ? : return #So here I want establish a situation about that if is not string #then , but how should write the ? #Or is there any other way to do it? Any sugg

Re: How to return an "not string' error in function?

2006-09-21 Thread breakfastea
Thank you so much it answers my humble question perfectly:) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to return an "not string' error in function?

2006-09-21 Thread breakfastea
Or yes that seems a handy way:) Thanks for all wonderful people here:) Peace Duncan Booth wrote: > Tim Chase <[EMAIL PROTECTED]> wrote: > > > This will return true for both regular strings and for unicode > > strings. If that's a problem, you can use > > > > >>> import types > > >>> isinstance

Re: How to return an "not string' error in function?

2006-09-21 Thread breakfastea
Thank you for your inputing which has been great inspirational:) What I tried to do is to write a string.split() module, so I started with: def spilt(a): l=[] index=0 if not isinstance(a, basestring): #Or isinstance(a, str) return for i in len(a): if a[i]=' ':

Re: How to return an "not string' error in function?

2006-09-21 Thread breakfastea
Thank you for your reminder:) However I saw the split() function in the first place and that why I'm trying write one myself:) Peace Bruno Desthuilliers wrote: > [EMAIL PROTECTED] wrote: > (OT : please dont top-post) > > > Thank you for your inputing which has been great inspirational:) > > > >