Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98707 > unrolled thread
| Started by | fl <rxjwg98@gmail.com> |
|---|---|
| First post | 2015-11-12 09:20 -0800 |
| Last post | 2015-11-12 17:24 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
Why does 'as' not recognized? fl <rxjwg98@gmail.com> - 2015-11-12 09:20 -0800
Re: Why does 'as' not recognized? John Gordon <gordon@panix.com> - 2015-11-12 17:24 +0000
| From | fl <rxjwg98@gmail.com> |
|---|---|
| Date | 2015-11-12 09:20 -0800 |
| Subject | Why does 'as' not recognized? |
| Message-ID | <8ddbc8fd-ebdb-4cd2-8e3b-b0e1f5142e76@googlegroups.com> |
Hi, When I try the following, python does not know 'as'. Why doesn't it? Thanks, >>> 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
[toc] | [next] | [standalone]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Date | 2015-11-12 17:24 +0000 |
| Message-ID | <n22i0g$nlg$1@reader1.panix.com> |
| In reply to | #98707 |
In <8ddbc8fd-ebdb-4cd2-8e3b-b0e1f5142e76@googlegroups.com> fl <rxjwg98@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@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web