Anthony Papillion wrote:
Hello Everyone,

Thanks to help from this group, my statistical project is going very
well and I'm learning a LOT about Python as I go. I'm absolutely
falling in love with this language and I'm now thinking about using it
for nearly all my projects.

I've run into another snag with nntplib I'm hoping someone can help me
with. I'm trying to get a list of newsgroups from the server. The
documentation for the list() method tells me it returns a response
(string) and a list (tuple).

The list tuple contains the following: groupname, last, first, flag.
So, thinking I could access the group name in that list like this
ThisGroup = groupname[1].

What's a "list tuple"? It's a list of tuples.

In each of the tuples the name of the group is at index 0.

Now, along those lines, I am wanting to retrieve some information
about each group in the list so I thought I could do this:

resp, groupinfo = server.list()
group = (info[1] for info in groupinfo)

'group' will be a generator, not a list. If you want a list of the names
of the groups, try:

group_names = [info[0] for info in groupinfo]

resp, count, first, last, name = server.group(group)

But Python throws a TypeError and tells me I "can't concatenate str
and generator objects'.

What am I doing wrong? I've been banging my head on this for a few
hours and simply can't get it right. I've even googled for an example
and couldn't find one that showed how to deal with this.

Can anyone help?

server.group expects the name of a single group, but you're giving it a
generator instead.

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

Reply via email to