On Tuesday, December 30, 2014 2:58:59 PM UTC-8, Alex Glaros wrote:
>
> for the var list, I get an "invalid syntax" error with an arrow under the
> "=" sign
>
> are parenthesis symbols supposed to be used instead of brackets?
>
> the arg list works well
>
I'm not sure what problem you're having, except that var is a dict.
I just verified the following works in the interactive shell:
$ python web2py.py -S welcome
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2014
Version 2.9.5-stable+timestamp.2014.03.16.02.35.39
Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(
pg8000), IMAP(imaplib)
2014-12-30 23:49:41,948 - web2py - WARNING - import IPython error; use
default python shell
Python 2.7.3 (default, Jul 24 2012, 11:41:34)
[GCC 4.6.3 20120306 (Red Hat 4.6.3-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> vardict = dict()
>>> vardict[1] = "one"
>>> print vardict
{1: 'one'}
>>> altdict = {}
>>> altdict["a"] = "eI"
>>> print altdict
{'a': 'eI'}
>>>
So you have 2 ways of creating an empty dict, and then you just assign
values to keys,
Here's a demo of the loop construct
>>> for x in range(2, 7):
... vardict[x] = chr(ord('a') + x) + chr(ord('z') - x)
...
>>> print vardict
{1: 'one', 2: 'cx', 3: 'dw', 4: 'ev', 5: 'fu', 6: 'gt'}
>>>
(I reused the vardict from above top when doing the near above loop)
Hope this helps; if you're still getting errors, you should post a sample
of your code that produces the error.
/dps
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.