Checking if elements are empty

O.R.Senthil Kumaran orsenthil at gmail.com
Wed Sep 5 11:48:39 EDT 2007


> Doran, Harold wrote:
> 
> I presume you meant
> 
> x = '  \t\'ff'
> 
> 
> > Is there a way to check if the first element of y is null?
> > 

You can use startswith() method of string objects.

if x.startswith(' '):
	print True


-- 
O.R.Senthil Kumaran
http://uthcode.sarovar.org



More information about the Python-list mailing list