Doran, Harold wrote:
> Dear list:
> 
> Suppose I have a string as follows
> 
> x = '  \t'ff'
> >>> x = '  \t'ff'
   File "<stdin>", line 1
     x = '  \t'ff'
                ^
SyntaxError: invalid syntax
>>>

I presume you meant

x = '  \t\'ff'


> I can split this up as
> 
> y = x.split('\t')
> 
> Which gives
> 
> [ '  ', 'ff']
> 
> len(y)
> 2
> 
> Is there a way to check if the first element of y is null?
> 

len(y[0]) == 0

would be the obvious way, assuming "null" means "the null string".

If whitespace is significant that'll do, if it isn't then you may need 
to use the strip() method to remove it before your scheck.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC/Ltd           http://www.holdenweb.com
Skype: holdenweb      http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to