Is there a way to pring a list object in Python?

Richard Thomas chardster at gmail.com
Sun Oct 31 08:00:12 CET 2010


On Oct 31, 5:42 am, Zeynel <azeyn... at gmail.com> wrote:
> class Rep(db.Model):
>     author = db.UserProperty()
>     replist = db.ListProperty(str)
>     unique = db.ListProperty(str)
>     date = db.DateTimeProperty(auto_now_add=True)
>
> ....
>
> Rep().replist = L
> Rep().put()
> mylist = Rep().all().fetch(10)
>
> I am trying to display mylist; but I am getting the object. Thanks.

You're using GAE? I suspect the return value of Query.fetch is an
iterator and not a list. You can make it a list by passing it to the
list constructor, like so:

mylist = list(Rep.all().fetch(10))

Richard.



More information about the Python-list mailing list