Why does 'as' not recognized?
John Gordon
gordon at panix.com
Thu Nov 12 12:24:32 EST 2015
In <8ddbc8fd-ebdb-4cd2-8e3b-b0e1f5142e76 at googlegroups.com> fl <rxjwg98 at gmail.com> writes:
> >>> cats = ['Tom', 'Snappy', 'Kitty', 'Jessie', 'Chester']
> >>>
> >>> type(cats)
> <type 'list'>
> >>> cats[2]
> 'Kitty'
> >>> as=cats[2]
> SyntaxError: invalid syntax
> >>> as=cats
> SyntaxError: invalid syntax
> >>> as
> SyntaxError: invalid syntax
'as' is a python language keyword, and cannot be used for variable names.
--
John Gordon A is for Amy, who fell down the stairs
gordon at panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
More information about the Python-list
mailing list