Small problem with print and comma

Dustan DustanGroups at gmail.com
Sun Jul 30 22:18:38 EDT 2006


Dennis Lee Bieber wrote:
> >     for i in range(0,len(param)):
> > 	print a[i],
>
> 	for it in param:
> 		print it,

That's one way. However, if you need the position (this is for future
reference; you don't need the position number here):

for i in range(len(param)+1):
    print a[i],

The last position was excluded because you forgot the '+1' part,
creating an off-by-one bug.




More information about the Python-list mailing list