Help doing it the "python way"
- From: Scott Siegler <scott.siegler@xxxxxxxxx>
- Date: Thu, 24 May 2012 13:22:43 -0700 (PDT)
Hello,
I am an experienced programmer but a beginner to python. As such, I can figure out a way to code most algorithms using more "C" style syntax.
I am doing something now that I am sure is a more python way but i can't quite get it right. I was hoping someone might help.
So I have a list of grid coordinates (x, y). From that list, I want to create a new list that for each coordinate, I add the coordinate just above and just below (x,y+1) and (x,y-1)
right now I am using a for loop to go through all the coordinates and then separate append statements to add the top and bottom.
is there a way to do something like: [(x,y-1), (x,y+1) for zzz in coord_list] or something along those lines?
thanks!
.
- Follow-Ups:
- Re: Help doing it the "python way"
- From: Jan Kuiken
- Re: Help doing it the "python way"
- From: Nobody
- Re: Help doing it the "python way"
- From: Paul Rubin
- Re: Help doing it the "python way"
- From: Duncan Booth
- Re: Help doing it the "python way"
- Prev by Date: Re: problem loading matlab data with ompc and python
- Next by Date: Re: Help doing it the "python way"
- Previous by thread: Embedding Python27 in C++ on Windows: CRT compatibility issues with VS2010?
- Next by thread: Re: Help doing it the "python way"
- Index(es):
Relevant Pages
|