From jon at upstartlabs.com Tue Jul 3 20:41:52 2012 From: jon at upstartlabs.com (Jon Baldivieso) Date: Tue, 3 Jul 2012 11:41:52 -0700 Subject: [portland] Know Django? Like beer? Message-ID: My company, Upstart Labs, is working with Taplister who is looking for a fast, resourceful Django developer starting immediately. We're looking for a freelancer, but depending on experience, this could develop into a full time Lead Developer role. If this is you or someone you know, please contact jobs at taplister.com. Taplister is a crowd-sourced site and mobile app that lists craft beer on tap at bars and restaurants. It was founded in 2009 and is based here in Portland. Thanks! Jon -------------- next part -------------- An HTML attachment was scrubbed... URL: From danlipert at gmail.com Fri Jul 6 01:22:40 2012 From: danlipert at gmail.com (Dan Lipert) Date: Thu, 5 Jul 2012 16:22:40 -0700 Subject: [portland] Django Freelance Developer needed - local or remote Message-ID: Hey Portland Pythonistas! - my small iOS app development studio is in need of some extra help adding new features to the backends of our apps. Our technology stack is PostgreSQL/PostGIS and Django, running on Webfaction shared hosts. We are looking for someone comfortable with APIs and Django, and any experience with OAuth and GeoDjango would be a plus. Drop me a line at dan at tmoa.us with a link to a portfolio/github/etc. and your hourly rate. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From michelle at pdxpython.org Fri Jul 6 18:42:19 2012 From: michelle at pdxpython.org (Michelle Rowley) Date: Fri, 6 Jul 2012 09:42:19 -0700 Subject: [portland] Meeting Tuesday, 7/10 at Urban Airship - sponsored by Smarsh Message-ID: <2F1CC964-B272-4B7F-88C0-7130F3CB3DEB@pdxpython.org> Hey Pythonistas! Our monthly presentation meeting is coming up in just a few days, on Tuesday, July 10th. This month, we're excited to have refreshments sponsored by Smarsh (http://www.smarsh.com/)! Smarsh is looking for talented software developers to join their team. Check out their careers page (http://www.smarsh.com/careers) for more info. Please take a moment to RSVP if you plan to share in the refreshments (http://meetu.ps/c8c4Y). We've got two speakers on deck for Tuesday's meeting. Wraithan will be giving a talk for beginners about iterators and generators, and Case Van Horsen will share an intermediate/advanced talk on C extensions. Following the presentations, we'll head over to Bailey's Taproom to continue the discussion. Hope to see you there! Michelle --- Urban Airship is at 334 NW 11th Ave, in the Pearl District: http://goo.gl/maps/U6mC The main door will probably be locked, but the back door, which leads directly to the event space, will be propped open. The back door is right around the corner on NW Flanders, next to the loading dock: http://goo.gl/maps/Ikbh --- Michelle Rowley @pythonchelle http://www.meetup.com/pdxpython From kirby.urner at gmail.com Sat Jul 7 17:59:55 2012 From: kirby.urner at gmail.com (kirby urner) Date: Sat, 7 Jul 2012 08:59:55 -0700 Subject: [portland] greetings and job opening Message-ID: Greetings all, hope to see you Tuesday. Here's another job opening / opportunity, which you can ask me more about off-line: http://hire.jobvite.com/CompanyJobs/Careers.aspx?c=q319VfwS&jvi=oILzWfwI,job The person filling this full time position would likely be working, along with me, on teaching Python (distance ed, not classroom -- no need to relocate (a key benefit for me)). PHP is a core focus too though, so knowledge of both is required. Might be doing more with PHP teaching than Python at first. Kirby Urner O'Reilly School of Technology From wescpy at gmail.com Thu Jul 12 20:12:05 2012 From: wescpy at gmail.com (wesley chun) Date: Thu, 12 Jul 2012 11:12:05 -0700 Subject: [portland] ANN: Intro+Intermediate Python, San Francisco, Aug 1-3 In-Reply-To: References: Message-ID: hello everyone, hope some of you enjoyed #EuroPython last week/end, and perhaps i'll see some of you at OSCON next week! as promised, here's the one and only FINAL REMINDER of the hardcore intro+intermediate Python course i'm offering 2012 Aug 1-3 near the San Francisco airport. reach out to me directly with any questions and let other folks know who may be interested. much appreciated! --wesley On Thu, May 10, 2012 at 11:16 AM, wesley chun wrote: > Greetings! > > I'll be doing a(nother) hardcore Python course this summer near the San > Francisco airport. If you're somewhat new to Python or have tinkered but > want to fill-in the holes, this course is for you. It's somewhat true > you can learn Python online, watching videos, or reading books, but it > still takes time and experience to master... I help accelerate this > process. The course is based on my bestselling "Core Python" books and > is made up of 3 full days complete with lectures and three hands-on > coding labs per day. > > Please pass on this message to your colleagues who also need to learn > Python. It's also a great excuse to coming to beautiful Northern > California for a summer vacation! More details at http://goo.gl/uW4oF > as well as the links in my .signature below. > > Since I hate spam, I'll only send out one more reminder as the date > gets closer... probably around OSCON's timeframe. -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "A computer never does what you want... only what you tell it." +wesley chun : wescpy at gmail : @wescpy Python training & consulting : http://CyberwebConsulting.com "Core Python" books : http://CorePython.com Python blog: http://wescpy.blogspot.com From rshepard at appl-ecosys.com Tue Jul 17 22:06:25 2012 From: rshepard at appl-ecosys.com (Rich Shepard) Date: Tue, 17 Jul 2012 13:06:25 -0700 (PDT) Subject: [portland] Data Structure Returned by readline() Message-ID: Disclaimer: it's been a couple of years since I last did any python coding so I have forgotten much of what I then knew. Now I need to finish an application and, before getting back to that, write a short script to restructure a data file. I've been trying to to work this all out myself but have not found an answer to the current blockage. Context: the data file was saved as a .csv from a LO spreadsheet. The top row (column headers) is a list of chemical symbols. Subsequent rows have a site ID, sampling date, and measured concentration for each chemical. I need to transform this file to one suitable for insertion in a database table. That is, each row consists of the site ID, sampling date, the symbol of a single chemical, and the measured quantity associated with it. While I do have a basic working knowledge of list comprehension I'm stumbling on reading the data into the script in a data type that would allow me to interate over each item in the row of chemical names and each data row. The immediate question is what data type is returned by readline()? The opening sections of code (for figuring out what I need to do) are: import sys infile = open(sys.argv[1], 'r') output = open("out.txt","w") # read column headers into a list col_headers = infile.readline() print col_headers # read the first three lines of data print infile.readline() print infile.readline() print infile.readline() The output of the above is: Ag,Al,CO3,HCO3,AlkTot,As,Ba,Be,Bi,Ca,Cd,Cl,Co,Cr,Cu,DO,Fe,Hg,K,Mg,Mn,Mo,Na,NH4,NO3NO2,oil_grease,Pb,pH,Sb,SC,Se,SO4,Sr,TDS,Tl,V,Zn D-1,2007-12-12,-0.005,0.106,-1.000,231.000,231.000,0.011,0.000,-0.002,0.000,100.000,0.000,1.430,0.000,-0.006,0.024,4.960,4.110,,0.000,9.560,0.035,0.000,0.970,-0.010,0.293,,0.025,7.800,-0.001,630.000,0.001,65.800,0.000,320.000,-0.001,0.000,11.400 D-1,2008-03-15,-0.005,-0.080,-1.000,228.000,228.000,0.001,0.000,-0.002,0.000,88.400,0.000,1.340,0.000,-0.006,0.014,9.910,0.309,0.000,0.000,9.150,0.047,0.000,0.820,0.224,-0.020,,0.025,7.940,-0.001,633.000,0.001,75.400,0.000,300.000,-0.001,0.000,12.400 D-1,2008-06-26,-0.005,0.116,6.700,118.000,124.000,0.010,0.000,-0.002,0.000,63.400,0.000,1.750,0.000,-0.006,0.020,4.320,2.830,0.000,0.000,9.550,0.020,0.000,0.653,-0.010,-0.050,,0.025,8.650,0.001,386.000,-0.001,68.500,0.000,480.000,-0.001,0.000,5.500 I've tried to index col_headers as I would a list, but 'print col_headers[0]' yields A rather than Ag. I see no indication in the output that these lines are lists, tuples, or another defined data type. Please provide a clue stick on how I should access the source file so I can then use for loops or list comprehension to restructure the file. TIA, Rich From ethan at stoneleaf.us Tue Jul 17 22:29:15 2012 From: ethan at stoneleaf.us (Ethan Furman) Date: Tue, 17 Jul 2012 13:29:15 -0700 Subject: [portland] Data Structure Returned by readline() In-Reply-To: References: Message-ID: <5005CB1B.4090901@stoneleaf.us> Rich Shepard wrote: > Disclaimer: it's been a couple of years since I last did any python > coding > so I have forgotten much of what I then knew. Now I need to finish an > application and, before getting back to that, write a short script to > restructure a data file. I've been trying to to work this all out myself > but > have not found an answer to the current blockage. > > Context: the data file was saved as a .csv from a LO spreadsheet. The top > row (column headers) is a list of chemical symbols. Subsequent rows have a > site ID, sampling date, and measured concentration for each chemical. I > need > to transform this file to one suitable for insertion in a database table. > That is, each row consists of the site ID, sampling date, the symbol of a > single chemical, and the measured quantity associated with it. > > While I do have a basic working knowledge of list comprehension I'm > stumbling on reading the data into the script in a data type that would > allow me to interate over each item in the row of chemical names and each > data row. > > The immediate question is what data type is returned by readline()? The > opening sections of code (for figuring out what I need to do) are: > > import sys > > infile = open(sys.argv[1], 'r') > output = open("out.txt","w") > > # read column headers into a list > col_headers = infile.readline() > print col_headers > # read the first three lines of data > print infile.readline() > print infile.readline() > print infile.readline() > > The output of the above is: > > Ag,Al,CO3,HCO3,AlkTot,As,Ba,Be,Bi,Ca,Cd,Cl,Co,Cr,Cu,DO,Fe,Hg,K,Mg,Mn,Mo,Na,NH4,NO3NO2,oil_grease,Pb,pH,Sb,SC,Se,SO4,Sr,TDS,Tl,V,Zn > > > D-1,2007-12-12,-0.005,0.106,-1.000,231.000,231.000,0.011,0.000,-0.002,0.000,100.000,0.000,1.430,0.000,-0.006,0.024,4.960,4.110,,0.000,9.560,0.035,0.000,0.970,-0.010,0.293,,0.025,7.800,-0.001,630.000,0.001,65.800,0.000,320.000,-0.001,0.000,11.400 > > > D-1,2008-03-15,-0.005,-0.080,-1.000,228.000,228.000,0.001,0.000,-0.002,0.000,88.400,0.000,1.340,0.000,-0.006,0.014,9.910,0.309,0.000,0.000,9.150,0.047,0.000,0.820,0.224,-0.020,,0.025,7.940,-0.001,633.000,0.001,75.400,0.000,300.000,-0.001,0.000,12.400 > > > D-1,2008-06-26,-0.005,0.116,6.700,118.000,124.000,0.010,0.000,-0.002,0.000,63.400,0.000,1.750,0.000,-0.006,0.020,4.320,2.830,0.000,0.000,9.550,0.020,0.000,0.653,-0.010,-0.050,,0.025,8.650,0.001,386.000,-0.001,68.500,0.000,480.000,-0.001,0.000,5.500 > > > I've tried to index col_headers as I would a list, but 'print > col_headers[0]' yields A rather than Ag. > > I see no indication in the output that these lines are lists, tuples, or > another defined data type. Please provide a clue stick on how I should > access the source file so I can then use for loops or list comprehension to > restructure the file. When in doubt, don't just 'print', but 'print repr(...)'. .readline() returns a string, which you can then manipulate yourself. For example, if you know there will be no embedded commas in the data you can: col_headers = infile.readline().split(',') # col_headers is now a list for line in infile.readlines(): data = line.split(',') But the csv module is probably worth looking into. ~Ethan~ From rshepard at appl-ecosys.com Tue Jul 17 22:26:40 2012 From: rshepard at appl-ecosys.com (Rich Shepard) Date: Tue, 17 Jul 2012 13:26:40 -0700 (PDT) Subject: [portland] Data Structure Returned by readline() In-Reply-To: <5005CB1B.4090901@stoneleaf.us> References: <5005CB1B.4090901@stoneleaf.us> Message-ID: On Tue, 17 Jul 2012, Ethan Furman wrote: > When in doubt, don't just 'print', but 'print repr(...)'. Ethan, I'll look at repr(); thanks. > .readline() returns a string, I thought so because when I tried ... > col_headers = infile.readline().split(',') # col_headers is now a list col_headers is a list, but when I try to print one item using an index integer python tells me I need an integer rather than a string as an index. Since that's what I thought I was providing the source of the error was opaque to me. > But the csv module is probably worth looking into. The original script (which did work for a while) uses the csv module, but the output is DOS (\r\n) rathat than UNIX (\n). That kept triping me when I manipulated the results untilI ran the file through the dos2unix filter. The source file is really a text file now; I took off the text quotes since the list ended up with double-quoted ("'...'") items in the list. Thanks, Rich From rshepard at appl-ecosys.com Tue Jul 17 22:32:17 2012 From: rshepard at appl-ecosys.com (Rich Shepard) Date: Tue, 17 Jul 2012 13:32:17 -0700 (PDT) Subject: [portland] Data Structure Returned by readline() In-Reply-To: References: <5005CB1B.4090901@stoneleaf.us> Message-ID: On Tue, 17 Jul 2012, Rich Shepard wrote: > I thought so because when I tried ... >> col_headers = infile.readline().split(',') # col_headers is now a list Now I see my error: I forced the items to be strings within the list by not using the proper syntax for the function. Thanks, Rich From tony at itmotives.com Tue Jul 17 23:19:46 2012 From: tony at itmotives.com (Tony Seminary) Date: Tue, 17 Jul 2012 21:19:46 +0000 Subject: [portland] Software Engineer (Java, Linux, Scripting) - Portland, OR Message-ID: <6A32DDEC1ED2F649B619871EBDCA58C61675C97F@BL2PRD0710MB361.namprd07.prod.outlook.com> Hello! We are looking for someone that is part Java Developer, part Linux Administrator, and part Scripting tool Developer. More information can be found here: http://www.itmotives.com/general/software-engineer-java-linux-scripting.htm . If you?re interested in working in a very fast-paced, cool, and fun kind of environment, please send your resume to me at tony at itmotives.com. Thank you! Tony Seminary Chief Executive Officer IT Motives, www.itmotives.com Native American Owned Business 503.706.2970 tony at itmotives.com www.linkedin.com/in/tonyseminary Twitter: tonyseminary -------------- next part -------------- An HTML attachment was scrubbed... URL: From rshepard at appl-ecosys.com Wed Jul 18 19:31:49 2012 From: rshepard at appl-ecosys.com (Rich Shepard) Date: Wed, 18 Jul 2012 10:31:49 -0700 (PDT) Subject: [portland] List Index Out Of Range In-Reply-To: References: Message-ID: I have an exception thrown for an index error that I do not see. Running the script through winpdb gives me no more insight into why the error is there (on line 27). Traceback (most recent call last): File "./wide-to-long.py", line 27, in output.write(str(chems[h])) IndexError: list index out of range Here's the script: #!/usr/bin/env python import sys """ First row of input file is list of chemical constituents. Following rows have site ID, sample date, and a quantity for each constituent. """ filename = sys.argv[1] infile = open(filename, 'r') output = open("out.txt","w") # read column headers into a list chems = infile.readline().split(',') h = 0 # header list index # read each data line d = 2 # data list index for line in infile.read().split('\n'): data = line.split(',') output.write(str(data[0])) output.write(',') output.write(str(data[1])) output.write(',') output.write(str(chems[h])) # site of index error. output.write(',') output.write(str(data[d])) output.write('\n') if h <= len(chems): h += 1 if d <= len(chems): d += 1 infile.close() output.close() ------------------------------ Sample data: Ag,Al,CO3,HCO3,AlkTot,As,Ba,Be,Bi,Ca,Cd,Cl,Co,Cr,Cu,DO,Fe,Hg,K,Mg,Mn,Mo,Na,NH4,NO3NO2,oil_grease,Pb,pH,Sb,SC,Se,SO4,Sr,TDS,Tl,V,Zn D-1,2007-12-12,-0.005,0.106,-1.000,231.000,231.000,0.011,0.000,-0.002,0.000,100.000,0.000,1.430,0.000,-0.006,0.024,4.960,4.110,,0.000,9.560,0.035,0.000,0.970,-0.010,0.293,,0.025,7.800,-0.001,630.000,0.001,65.800,0.000,320.000,-0.001,0.000,11.400 D-1,2008-03-15,-0.005,-0.080,-1.000,228.000,228.000,0.001,0.000,-0.002,0.000,88.400,0.000,1.340,0.000,-0.006,0.014,9.910,0.309,0.000,0.000,9.150,0.047,0.000,0.820,0.224,-0.020,,0.025,7.940,-0.001,633.000,0.001,75.400,0.000,300.000,-0.001,0.000,12.400 D-1,2008-06-26,-0.005,0.116,6.700,118.000,124.000,0.010,0.000,-0.002,0.000,63.400,0.000,1.750,0.000,-0.006,0.020,4.320,2.830,0.000,0.000,9.550,0.020,0.000,0.653,-0.010,-0.050,,0.025,8.650,0.001,386.000,-0.001,68.500,0.000,480.000,-0.001,0.000,5.500 A clue stick appropriately applied will be very helpful. TIA, Rich From pat.w.brooks at gmail.com Wed Jul 18 19:46:13 2012 From: pat.w.brooks at gmail.com (Patrick Brooks) Date: Wed, 18 Jul 2012 10:46:13 -0700 Subject: [portland] List Index Out Of Range In-Reply-To: References: Message-ID: if h <= len(chems): h += 1 maybe that should be h < len(chems) On Wed, Jul 18, 2012 at 10:31 AM, Rich Shepard wrote: > I have an exception thrown for an index error that I do not see. Running > the script through winpdb gives me no more insight into why the error is > there (on line 27). > > Traceback (most recent call last): > File "./wide-to-long.py", line 27, in > output.write(str(chems[h])) > IndexError: list index out of range > > Here's the script: > > #!/usr/bin/env python > > import sys > > """ > First row of input file is list of chemical constituents. Following rows > have > site ID, sample date, and a quantity for each constituent. > """ > filename = sys.argv[1] > > infile = open(filename, 'r') > output = open("out.txt","w") > > # read column headers into a list > chems = infile.readline().split(',') > h = 0 # header list index > > # read each data line > d = 2 # data list index > > for line in infile.read().split('\n'): > data = line.split(',') > output.write(str(data[0])) > output.write(',') > output.write(str(data[1])) > output.write(',') > output.write(str(chems[h])) # site of index error. > output.write(',') > output.write(str(data[d])) > output.write('\n') > if h <= len(chems): > h += 1 > if d <= len(chems): > d += 1 > > infile.close() > output.close() > > ------------------------------ > > Sample data: > > Ag,Al,CO3,HCO3,AlkTot,As,Ba,**Be,Bi,Ca,Cd,Cl,Co,Cr,Cu,DO,Fe,** > Hg,K,Mg,Mn,Mo,Na,NH4,NO3NO2,**oil_grease,Pb,pH,Sb,SC,Se,SO4,** > Sr,TDS,Tl,V,Zn > D-1,2007-12-12,-0.005,0.106,-**1.000,231.000,231.000,0.011,0.** > 000,-0.002,0.000,100.000,0.**000,1.430,0.000,-0.006,0.024,** > 4.960,4.110,,0.000,9.560,0.**035,0.000,0.970,-0.010,0.293,,** > 0.025,7.800,-0.001,630.000,0.**001,65.800,0.000,320.000,-0.** > 001,0.000,11.400 > D-1,2008-03-15,-0.005,-0.080,-**1.000,228.000,228.000,0.001,0.** > 000,-0.002,0.000,88.400,0.000,**1.340,0.000,-0.006,0.014,9.** > 910,0.309,0.000,0.000,9.150,0.**047,0.000,0.820,0.224,-0.020,,** > 0.025,7.940,-0.001,633.000,0.**001,75.400,0.000,300.000,-0.** > 001,0.000,12.400 > D-1,2008-06-26,-0.005,0.116,6.**700,118.000,124.000,0.010,0.** > 000,-0.002,0.000,63.400,0.000,**1.750,0.000,-0.006,0.020,4.** > 320,2.830,0.000,0.000,9.550,0.**020,0.000,0.653,-0.010,-0.050,** > ,0.025,8.650,0.001,386.000,-0.**001,68.500,0.000,480.000,-0.** > 001,0.000,5.500 > > A clue stick appropriately applied will be very helpful. > > TIA, > > Rich > > ______________________________**_________________ > Portland mailing list > Portland at python.org > http://mail.python.org/**mailman/listinfo/portland > -------------- next part -------------- An HTML attachment was scrubbed... URL: From monk at netjunky.com Wed Jul 18 19:55:06 2012 From: monk at netjunky.com (Jonathan Karon) Date: Wed, 18 Jul 2012 10:55:06 -0700 Subject: [portland] List Index Out Of Range In-Reply-To: References: Message-ID: <96B454B8-4A8E-402F-B585-E38EEA4BC323@netjunky.com> Hi Rich, It looks to me like what you want to be doing is looping over elements 2 through N in each row of data, i.e. implementing a 2-dimensional loop maybe this is what you want? #!/usr/bin/env python import sys """ First row of input file is list of chemical constituents. Following rows have site ID, sample date, and a quantity for each constituent. """ filename = sys.argv[1] infile = open(filename, 'r') output = open("out.txt","w") # read column headers into a list chems = infile.readline().split(',') d = 2 # offset of first data element in each row for line in infile.read().split('\n'): data = line.split(',') # returns a list of strings, no need to cast the elements using str() sensor = data[0] timestamp = data[1] samples = data[2:] # samples is a list of just the values from this row # note: data file format assumes len(data) == len(chems) + 2, thus len(samples) == len(chems) line_out = [sensor, timestamp, ] # create a list for generating our output for i in range(len(chems)): # loop over the chems header values line_out.append(chems[i]) # append chem name line_out.append(samples[i]) # append sample value output.write(','.join(line_out)) # create a string by concatenating the output values with comma separator output.write('\n') # line feed infile.close() output.close() On Jul 18, 2012, at 10:31 AM, Rich Shepard wrote: > I have an exception thrown for an index error that I do not see. Running > the script through winpdb gives me no more insight into why the error is > there (on line 27). > > Traceback (most recent call last): > File "./wide-to-long.py", line 27, in > output.write(str(chems[h])) > IndexError: list index out of range > > Here's the script: > > #!/usr/bin/env python > > import sys > > """ > First row of input file is list of chemical constituents. Following rows have > site ID, sample date, and a quantity for each constituent. > """ > filename = sys.argv[1] > > infile = open(filename, 'r') > output = open("out.txt","w") > > # read column headers into a list > chems = infile.readline().split(',') > h = 0 # header list index > > # read each data line > d = 2 # data list index > > for line in infile.read().split('\n'): > data = line.split(',') > output.write(str(data[0])) > output.write(',') > output.write(str(data[1])) > output.write(',') > output.write(str(chems[h])) # site of index error. > output.write(',') > output.write(str(data[d])) > output.write('\n') > if h <= len(chems): > h += 1 > if d <= len(chems): > d += 1 > > infile.close() > output.close() > > ------------------------------ > > Sample data: > > Ag,Al,CO3,HCO3,AlkTot,As,Ba,Be,Bi,Ca,Cd,Cl,Co,Cr,Cu,DO,Fe,Hg,K,Mg,Mn,Mo,Na,NH4,NO3NO2,oil_grease,Pb,pH,Sb,SC,Se,SO4,Sr,TDS,Tl,V,Zn > D-1,2007-12-12,-0.005,0.106,-1.000,231.000,231.000,0.011,0.000,-0.002,0.000,100.000,0.000,1.430,0.000,-0.006,0.024,4.960,4.110,,0.000,9.560,0.035,0.000,0.970,-0.010,0.293,,0.025,7.800,-0.001,630.000,0.001,65.800,0.000,320.000,-0.001,0.000,11.400 > D-1,2008-03-15,-0.005,-0.080,-1.000,228.000,228.000,0.001,0.000,-0.002,0.000,88.400,0.000,1.340,0.000,-0.006,0.014,9.910,0.309,0.000,0.000,9.150,0.047,0.000,0.820,0.224,-0.020,,0.025,7.940,-0.001,633.000,0.001,75.400,0.000,300.000,-0.001,0.000,12.400 > D-1,2008-06-26,-0.005,0.116,6.700,118.000,124.000,0.010,0.000,-0.002,0.000,63.400,0.000,1.750,0.000,-0.006,0.020,4.320,2.830,0.000,0.000,9.550,0.020,0.000,0.653,-0.010,-0.050,,0.025,8.650,0.001,386.000,-0.001,68.500,0.000,480.000,-0.001,0.000,5.500 > > A clue stick appropriately applied will be very helpful. > > TIA, > > Rich > > _______________________________________________ > Portland mailing list > Portland at python.org > http://mail.python.org/mailman/listinfo/portland From monk at netjunky.com Wed Jul 18 20:02:58 2012 From: monk at netjunky.com (Jonathan Karon) Date: Wed, 18 Jul 2012 11:02:58 -0700 Subject: [portland] List Index Out Of Range In-Reply-To: <96B454B8-4A8E-402F-B585-E38EEA4BC323@netjunky.com> References: <96B454B8-4A8E-402F-B585-E38EEA4BC323@netjunky.com> Message-ID: Whoops. That would output all of the samples from a line of input on a single line in the output, whereas what I think you want is one line per column yes? This version gives you one line per column: for line in infile.read().split('\n'): data = line.split(',') # returns a list of strings, no need to cast the elements using str() sensor = data[0] timestamp = data[1] samples = data[2:] # samples is a list of just the values from this row # note: data file format assumes len(data) == len(chems) + 2, thus len(samples) == len(chems) for i in range(len(chems)): # loop over the chems header values output.write(','.join( [ sensor, timestamp, chems[i], samples[i] ] )) output.write('\n') # line feed On Jul 18, 2012, at 10:55 AM, Jonathan Karon wrote: > Hi Rich, > > It looks to me like what you want to be doing is looping over elements 2 through N in each row of data, i.e. implementing a 2-dimensional loop > > maybe this is what you want? > > #!/usr/bin/env python > > import sys > > """ > First row of input file is list of chemical constituents. Following rows have > site ID, sample date, and a quantity for each constituent. > """ > filename = sys.argv[1] > > infile = open(filename, 'r') > output = open("out.txt","w") > > # read column headers into a list > chems = infile.readline().split(',') > > d = 2 # offset of first data element in each row > > > for line in infile.read().split('\n'): > data = line.split(',') # returns a list of strings, no need to cast the elements using str() > sensor = data[0] > timestamp = data[1] > samples = data[2:] # samples is a list of just the values from this row > > # note: data file format assumes len(data) == len(chems) + 2, thus len(samples) == len(chems) > > line_out = [sensor, timestamp, ] # create a list for generating our output > > for i in range(len(chems)): # loop over the chems header values > line_out.append(chems[i]) # append chem name > line_out.append(samples[i]) # append sample value > > output.write(','.join(line_out)) # create a string by concatenating the output values with comma separator > output.write('\n') # line feed > > infile.close() > output.close() > > On Jul 18, 2012, at 10:31 AM, Rich Shepard wrote: > >> I have an exception thrown for an index error that I do not see. Running >> the script through winpdb gives me no more insight into why the error is >> there (on line 27). >> >> Traceback (most recent call last): >> File "./wide-to-long.py", line 27, in >> output.write(str(chems[h])) >> IndexError: list index out of range >> >> Here's the script: >> >> #!/usr/bin/env python >> >> import sys >> >> """ >> First row of input file is list of chemical constituents. Following rows have >> site ID, sample date, and a quantity for each constituent. >> """ >> filename = sys.argv[1] >> >> infile = open(filename, 'r') >> output = open("out.txt","w") >> >> # read column headers into a list >> chems = infile.readline().split(',') >> h = 0 # header list index >> >> # read each data line >> d = 2 # data list index >> >> for line in infile.read().split('\n'): >> data = line.split(',') >> output.write(str(data[0])) >> output.write(',') >> output.write(str(data[1])) >> output.write(',') >> output.write(str(chems[h])) # site of index error. >> output.write(',') >> output.write(str(data[d])) >> output.write('\n') >> if h <= len(chems): >> h += 1 >> if d <= len(chems): >> d += 1 >> >> infile.close() >> output.close() >> >> ------------------------------ >> >> Sample data: >> >> Ag,Al,CO3,HCO3,AlkTot,As,Ba,Be,Bi,Ca,Cd,Cl,Co,Cr,Cu,DO,Fe,Hg,K,Mg,Mn,Mo,Na,NH4,NO3NO2,oil_grease,Pb,pH,Sb,SC,Se,SO4,Sr,TDS,Tl,V,Zn >> D-1,2007-12-12,-0.005,0.106,-1.000,231.000,231.000,0.011,0.000,-0.002,0.000,100.000,0.000,1.430,0.000,-0.006,0.024,4.960,4.110,,0.000,9.560,0.035,0.000,0.970,-0.010,0.293,,0.025,7.800,-0.001,630.000,0.001,65.800,0.000,320.000,-0.001,0.000,11.400 >> D-1,2008-03-15,-0.005,-0.080,-1.000,228.000,228.000,0.001,0.000,-0.002,0.000,88.400,0.000,1.340,0.000,-0.006,0.014,9.910,0.309,0.000,0.000,9.150,0.047,0.000,0.820,0.224,-0.020,,0.025,7.940,-0.001,633.000,0.001,75.400,0.000,300.000,-0.001,0.000,12.400 >> D-1,2008-06-26,-0.005,0.116,6.700,118.000,124.000,0.010,0.000,-0.002,0.000,63.400,0.000,1.750,0.000,-0.006,0.020,4.320,2.830,0.000,0.000,9.550,0.020,0.000,0.653,-0.010,-0.050,,0.025,8.650,0.001,386.000,-0.001,68.500,0.000,480.000,-0.001,0.000,5.500 >> >> A clue stick appropriately applied will be very helpful. >> >> TIA, >> >> Rich >> >> _______________________________________________ >> Portland mailing list >> Portland at python.org >> http://mail.python.org/mailman/listinfo/portland > ~jonathan ---- Jonathan Karon Director, NetJunky Research Software Architecture & Forward-Looking Mobile Applications e. monk at netjunky.com p. 503-233-8128 f. 503-334-1258 tw. @fightingmonk From rshepard at appl-ecosys.com Wed Jul 18 20:13:46 2012 From: rshepard at appl-ecosys.com (Rich Shepard) Date: Wed, 18 Jul 2012 11:13:46 -0700 (PDT) Subject: [portland] List Index Out Of Range In-Reply-To: References: Message-ID: On Wed, 18 Jul 2012, Patrick Brooks wrote: > if h <= len(chems): > h += 1 > > maybe that should be h < len(chems) Patrick, I had tried that before, and again now, but the error remains. Thanks, Rich From rshepard at appl-ecosys.com Wed Jul 18 20:15:55 2012 From: rshepard at appl-ecosys.com (Rich Shepard) Date: Wed, 18 Jul 2012 11:15:55 -0700 (PDT) Subject: [portland] List Index Out Of Range In-Reply-To: <96B454B8-4A8E-402F-B585-E38EEA4BC323@netjunky.com> References: <96B454B8-4A8E-402F-B585-E38EEA4BC323@netjunky.com> Message-ID: On Wed, 18 Jul 2012, Jonathan Karon wrote: > It looks to me like what you want to be doing is looping over elements 2 > through N in each row of data, i.e. implementing a 2-dimensional loop Jonathan, Yep. > maybe this is what you want? I'll try it ... with the correction in your follow up message. This code looks like what I tried unsuccessfully to implement before I dropped back to what I thought was more simple if less pythonic. Thanks, Rich From rshepard at appl-ecosys.com Wed Jul 18 20:27:04 2012 From: rshepard at appl-ecosys.com (Rich Shepard) Date: Wed, 18 Jul 2012 11:27:04 -0700 (PDT) Subject: [portland] List Index Out Of Range In-Reply-To: References: <96B454B8-4A8E-402F-B585-E38EEA4BC323@netjunky.com> Message-ID: On Wed, 18 Jul 2012, Jonathan Karon wrote: > This version gives you one line per column: Jonathan, Almost! It runs to completion (132K lines), but there's still a list index error thrown and the quantity associated with the last chemical is on a new line. It would be helpful for me to understand these two errors. Here's what python shows: Traceback (most recent call last): File "./wide-to-long.py", line 24, in timestamp = data[1] IndexError: list index out of range And here are the last few lines of one site/date set and the beginning few lines of the next one: D-1,2007-12-12,V,0.000 D-1,2007-12-12,Zn ,11.400 D-1,2008-03-15,Ag,-0.005 D-1,2008-03-15,Al,-0.080 Both the python error and the format issue must be simple but I still don't see the reasons. Thanks, Rich From monk at netjunky.com Wed Jul 18 20:46:03 2012 From: monk at netjunky.com (Jonathan Karon) Date: Wed, 18 Jul 2012 11:46:03 -0700 Subject: [portland] List Index Out Of Range In-Reply-To: References: <96B454B8-4A8E-402F-B585-E38EEA4BC323@netjunky.com> Message-ID: <71C78D2A-6C8C-4F02-9093-8FF97C9E9B85@netjunky.com> See below... On Jul 18, 2012, at 11:27 AM, Rich Shepard wrote: > On Wed, 18 Jul 2012, Jonathan Karon wrote: > >> This version gives you one line per column: > > Jonathan, > > Almost! It runs to completion (132K lines), but there's still a list index > error thrown and the quantity associated with the last chemical is on a new > line. It would be helpful for me to understand these two errors. > > Here's what python shows: > > Traceback (most recent call last): > File "./wide-to-long.py", line 24, in > timestamp = data[1] > IndexError: list index out of range This is likely happening because the last line of the file is blank. "data\ndata\n".split('\n') will return 3 values - 2 with the text "data" and one a string with 0 length The simplest thing to do is this: for line in infile.read().split('\n'): if not len(line.strip()): continue # ignore blank lines # ... existing code here ... > > And here are the last few lines of one site/date set and the beginning few > lines of the next one: > > D-1,2007-12-12,V,0.000 > D-1,2007-12-12,Zn > ,11.400 > D-1,2008-03-15,Ag,-0.005 > D-1,2008-03-15,Al,-0.080 From http://docs.python.org/tutorial/inputoutput.html#methods-of-file-objects : " f.readline() reads a single line from the file; a newline character (\n) is left at the end of the string " The last element of your chems list will still contain that trailing linefeed. Try this when initially loading the chems list: chems = [c.strip() for c in infile.readline().split(',')] > > Both the python error and the format issue must be simple but I still > don't see the reasons. > > Thanks, > > Rich > > _______________________________________________ > Portland mailing list > Portland at python.org > http://mail.python.org/mailman/listinfo/portland From ethan at stoneleaf.us Wed Jul 18 21:09:13 2012 From: ethan at stoneleaf.us (Ethan Furman) Date: Wed, 18 Jul 2012 12:09:13 -0700 Subject: [portland] List Index Out Of Range In-Reply-To: <71C78D2A-6C8C-4F02-9093-8FF97C9E9B85@netjunky.com> References: <96B454B8-4A8E-402F-B585-E38EEA4BC323@netjunky.com> <71C78D2A-6C8C-4F02-9093-8FF97C9E9B85@netjunky.com> Message-ID: <500709D9.90703@stoneleaf.us> Jonathan Karon wrote: > This is likely happening because the last line of the file is blank. "data\ndata\n".split('\n') will return 3 values - 2 with the text "data" and one a string with 0 length > > The simplest thing to do is this: > > for line in infile.read().split('\n'): > if not len(line.strip()): continue # ignore blank lines if not line.strip(): continue # no need for the len() check > > # ... existing code here ... > >> From http://docs.python.org/tutorial/inputoutput.html#methods-of-file-objects : > " f.readline() reads a single line from the file; a newline character (\n) is left at the end of the string " > > The last element of your chems list will still contain that trailing linefeed. Try this when initially loading the chems list: > > chems = [c.strip() for c in infile.readline().split(',')] or, if not concerned about whitespace in the element headers: chems = infile.readline().strip().split(',') ~Ethan~ From rshepard at appl-ecosys.com Wed Jul 18 21:03:22 2012 From: rshepard at appl-ecosys.com (Rich Shepard) Date: Wed, 18 Jul 2012 12:03:22 -0700 (PDT) Subject: [portland] List Index Out Of Range [RESOLVED] In-Reply-To: <71C78D2A-6C8C-4F02-9093-8FF97C9E9B85@netjunky.com> References: <96B454B8-4A8E-402F-B585-E38EEA4BC323@netjunky.com> <71C78D2A-6C8C-4F02-9093-8FF97C9E9B85@netjunky.com> Message-ID: On Wed, 18 Jul 2012, Jonathan Karon wrote: > if not len(line.strip()): continue # ignore blank lines Ah, that does make sense. Didn't think of that. > " f.readline() reads a single line from the file; a newline character (\n) > is left at the end of the string " > > The last element of your chems list will still contain that trailing > linefeed. Try this when initially loading the chems list: > > chems = [c.strip() for c in infile.readline().split(',')] That did the trick. Thank you both, Jonathan and Ethan, for the lessons. Much appreciated, Rich From mrowley at gmail.com Sun Jul 29 04:38:16 2012 From: mrowley at gmail.com (Michelle Rowley) Date: Sat, 28 Jul 2012 19:38:16 -0700 Subject: [portland] 360 image from hack night Message-ID: <4004331798445676397@unknownmsgid> Does anyone have the link to robotadam's photos from the last hack night? Thanks! Michelle From fractalid at gmail.com Sun Jul 29 07:40:50 2012 From: fractalid at gmail.com (Nathan Miller) Date: Sat, 28 Jul 2012 22:40:50 -0700 Subject: [portland] 360 image from hack night In-Reply-To: <4004331798445676397@unknownmsgid> References: <4004331798445676397@unknownmsgid> Message-ID: http://360.io/FygsLx http://360.io/6LBLWS http://360.io/vGnx66 (I knew I kept IRC logs around for something...) On Sat, Jul 28, 2012 at 7:38 PM, Michelle Rowley wrote: > Does anyone have the link to robotadam's photos from the last hack night? > > Thanks! > Michelle > _______________________________________________ > Portland mailing list > Portland at python.org > http://mail.python.org/mailman/listinfo/portland From virajbsharma at gmail.com Sun Jul 29 08:28:22 2012 From: virajbsharma at gmail.com (Viraj Sharma) Date: Sun, 29 Jul 2012 02:28:22 -0400 Subject: [portland] Alternatives to Globals for passing information between methods. Message-ID: All, I was recently introduced to programming, so this is really a beginner's query. Let me know if this is not the right mailing list for that. I will switch it accordingly. Anyway to my query: I have heard that the "Globals are bad for programming" - ( http://c2.com/cgi/wiki?GlobalVariablesAreBad). Keeping that in mind, I need to change my solution from below to something more elegant. Can someone let me know the best solution for sharing the values of Num1 and Num2 in the example given below. From my perspective 3 options came into my mind when I coded this #1. Was to use Globals (Num1 and Num2) to pass variable values between the various methods. #2. Was to create an object and have Num1 and Num2 defined as class member variables. In that case, the value of these variables could be used across multiple methods defined on that class. #3. Was to use an array/list type data structure, store the Num1 and Num2 values in it and then return that structure everytime I want to expose the value of Num1 and Num2 between various method calls. It is possible that there maybe more elegant solutions. But I quite frankly do not know how to decide. Therefore requesting help ... =================================================== #!/usr/bin/env python __author__ = 'vsharma' Num1 = 0 Num2 = 0 def captureInput(): # Capture Input - Get the 2 numbers to be checked for connectivity. # Remember to do a file based parsing logic for the same. global Num1, Num2 Num1 = int(raw_input('First Number: ').rstrip('\n')) Num2 = int(raw_input('Second Number: ').rstrip('\n')) print "Checking (", num1, ",", num2, ")" def doConnectivityCheck(Num1, Num2): # I have removed the actual code for simplicity print "The following 2 numbers are connected (", Num1, ",", Num2, ")" return def storeInput(Num1, Num2): # I have removed the actual code for simplicity print "The following 2 numbers have been stored (", Num1, ",", Num2, ")" return def main(): userResponseFlag = 1 while userResponseFlag: userResponse = raw_input('Do you want to check connectivity between 2 given numbers - answer(y/n) only: ') if userResponse == 'y': captureInput() doConnectivityCheck(Num1, Num2) storeInput(Num1, Num2) elif userResponse == 'n': userResponseFlag = 0 else: print "Your input does not confirm to the y/n rule, fix that and retry" continue main() =================================================== -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrowley at gmail.com Sun Jul 29 10:09:00 2012 From: mrowley at gmail.com (Michelle Rowley) Date: Sun, 29 Jul 2012 01:09:00 -0700 Subject: [portland] 360 image from hack night In-Reply-To: References: <4004331798445676397@unknownmsgid> Message-ID: <8966046861803407929@unknownmsgid> I just sang a song about this!!! Thank you :) On Jul 28, 2012, at 10:44 PM, Nathan Miller wrote: > http://360.io/FygsLx > http://360.io/6LBLWS > http://360.io/vGnx66 > > (I knew I kept IRC logs around for something...) > > On Sat, Jul 28, 2012 at 7:38 PM, Michelle Rowley wrote: >> Does anyone have the link to robotadam's photos from the last hack night? >> >> Thanks! >> Michelle >> _______________________________________________ >> Portland mailing list >> Portland at python.org >> http://mail.python.org/mailman/listinfo/portland > _______________________________________________ > Portland mailing list > Portland at python.org > http://mail.python.org/mailman/listinfo/portland From andrew.lorente at gmail.com Sun Jul 29 10:24:19 2012 From: andrew.lorente at gmail.com (Andrew Lorente) Date: Sun, 29 Jul 2012 01:24:19 -0700 Subject: [portland] Alternatives to Globals for passing information between methods. In-Reply-To: References: Message-ID: Hi Viraj, I think your idea #2--putting these methods on an object and making num1/2 be attributes of it--is the way to go. However, #3 is probably easier than you'd guess. Python lets you return a tuple and then break up the returned tuple in the calling code. This makes it really easy to define functions that return multiple values, without having to write up a big ol' data structure to hold those values: >>> def foo(): ... return (1, 'a') ... >>> (val1, val2) = foo() >>> val1 1 >>> val2 'a' Here's that notion applied to the relevant bits of your code: def captureInput(): # Capture Input - Get the 2 numbers to be checked for connectivity. # Remember to do a file based parsing logic for the same. * # (the `global` declaration has been removed)* Num1 = int(raw_input('First Number: ').rstrip('\n')) Num2 = int(raw_input('Second Number: ').rstrip('\n')) print "Checking (", num1, ",", num2, ")" * return (Num1, Num2) * def main(): userResponseFlag = 1 while userResponseFlag: userResponse = raw_input('Do you want to check connectivity between 2 given numbers - answer(y/n) only: ') if userResponse == 'y': * (Num1, Num2) = captureInput()* doConnectivityCheck(Num1, Num2) storeInput(Num1, Num2) elif userResponse == 'n': userResponseFlag = 0 else: print "Your input does not confirm to the y/n rule, fix that and retry" continue However, I think making Num1 and 2 instance attributes will prove to be more convenient. Hope this helps! Andrew On Sat, Jul 28, 2012 at 11:28 PM, Viraj Sharma wrote: > All, > I was recently introduced to programming, so this is really a beginner's > query. Let me know if this is not the right mailing list for that. I will > switch it accordingly. Anyway to my query: > > I have heard that the "Globals are bad for programming" - ( > http://c2.com/cgi/wiki?GlobalVariablesAreBad). Keeping that in mind, I > need > to change my solution from below to something more elegant. > > Can someone let me know the best solution for sharing the values of Num1 > and Num2 in the example given below. From my perspective 3 options came > into my mind when I coded this > > #1. Was to use Globals (Num1 and Num2) to pass variable values between the > various methods. > > #2. Was to create an object and have Num1 and Num2 defined as class member > variables. In that case, the value of these variables could be used across > multiple methods defined on that class. > > #3. Was to use an array/list type data structure, store the Num1 and Num2 > values in it and then return that structure everytime I want to expose the > value of Num1 and Num2 between various method calls. > > It is possible that there maybe more elegant solutions. But I quite frankly > do not know how to decide. Therefore requesting help ... > > > =================================================== > #!/usr/bin/env python > > __author__ = 'vsharma' > > Num1 = 0 > Num2 = 0 > > def captureInput(): > # Capture Input - Get the 2 numbers to be checked for connectivity. > # Remember to do a file based parsing logic for the same. > global Num1, Num2 > Num1 = int(raw_input('First Number: ').rstrip('\n')) > Num2 = int(raw_input('Second Number: ').rstrip('\n')) > print "Checking (", num1, ",", num2, ")" > > def doConnectivityCheck(Num1, Num2): > # I have removed the actual code for simplicity > print "The following 2 numbers are connected (", Num1, ",", Num2, ")" > > return > > def storeInput(Num1, Num2): > # I have removed the actual code for simplicity > print "The following 2 numbers have been stored (", Num1, ",", Num2, > ")" > return > > def main(): > userResponseFlag = 1 > while userResponseFlag: > userResponse = raw_input('Do you want to check connectivity between > 2 given numbers - answer(y/n) only: ') > if userResponse == 'y': > captureInput() > doConnectivityCheck(Num1, Num2) > storeInput(Num1, Num2) > elif userResponse == 'n': > userResponseFlag = 0 > else: > print "Your input does not confirm to the y/n rule, fix that > and retry" > continue > > main() > =================================================== > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/portland/attachments/20120729/460d0530/attachment.html > > > _______________________________________________ > Portland mailing list > Portland at python.org > http://mail.python.org/mailman/listinfo/portland > -------------- next part -------------- An HTML attachment was scrubbed... URL: From virajbsharma at gmail.com Mon Jul 30 03:11:18 2012 From: virajbsharma at gmail.com (Viraj Sharma) Date: Sun, 29 Jul 2012 21:11:18 -0400 Subject: [portland] Alternatives to Globals for passing information between methods. In-Reply-To: References: Message-ID: Hi Andrew, I really appreciate your precise yet detailed response. No wonder python has prospered as a language. Thanks to efforts from people like you. Viraj Sharma On Sun, Jul 29, 2012 at 4:24 AM, Andrew Lorente wrote: > Hi Viraj, > > I think your idea #2--putting these methods on an object and making num1/2 > be attributes of it--is the way to go. However, #3 is probably easier than > you'd guess. Python lets you return a tuple and then break up the returned > tuple in the calling code. This makes it really easy to define functions > that return multiple values, without having to write up a big ol' data > structure to hold those values: > > >>> def foo(): > ... return (1, 'a') > ... > >>> (val1, val2) = foo() > >>> val1 > 1 > >>> val2 > 'a' > > Here's that notion applied to the relevant bits of your code: > > def captureInput(): > # Capture Input - Get the 2 numbers to be checked for connectivity. > # Remember to do a file based parsing logic for the same. > * # (the `global` declaration has been removed)* > Num1 = int(raw_input('First Number: ').rstrip('\n')) > Num2 = int(raw_input('Second Number: ').rstrip('\n')) > print "Checking (", num1, ",", num2, ")" > * return (Num1, Num2) > * > def main(): > userResponseFlag = 1 > while userResponseFlag: > userResponse = raw_input('Do you want to check connectivity between > 2 given numbers - answer(y/n) only: ') > if userResponse == 'y': > * (Num1, Num2) = captureInput()* > doConnectivityCheck(Num1, Num2) > storeInput(Num1, Num2) > elif userResponse == 'n': > userResponseFlag = 0 > else: > print "Your input does not confirm to the y/n rule, fix that > and retry" > continue > > > However, I think making Num1 and 2 instance attributes will prove to be > more convenient. > > Hope this helps! > > Andrew > > On Sat, Jul 28, 2012 at 11:28 PM, Viraj Sharma >wrote: > > > All, > > I was recently introduced to programming, so this is really a > beginner's > > query. Let me know if this is not the right mailing list for that. I will > > switch it accordingly. Anyway to my query: > > > > I have heard that the "Globals are bad for programming" - ( > > http://c2.com/cgi/wiki?GlobalVariablesAreBad). Keeping that in mind, I > > need > > to change my solution from below to something more elegant. > > > > Can someone let me know the best solution for sharing the values of Num1 > > and Num2 in the example given below. From my perspective 3 options came > > into my mind when I coded this > > > > #1. Was to use Globals (Num1 and Num2) to pass variable values between > the > > various methods. > > > > #2. Was to create an object and have Num1 and Num2 defined as class > member > > variables. In that case, the value of these variables could be used > across > > multiple methods defined on that class. > > > > #3. Was to use an array/list type data structure, store the Num1 and Num2 > > values in it and then return that structure everytime I want to expose > the > > value of Num1 and Num2 between various method calls. > > > > It is possible that there maybe more elegant solutions. But I quite > frankly > > do not know how to decide. Therefore requesting help ... > > > > > > =================================================== > > #!/usr/bin/env python > > > > __author__ = 'vsharma' > > > > Num1 = 0 > > Num2 = 0 > > > > def captureInput(): > > # Capture Input - Get the 2 numbers to be checked for connectivity. > > # Remember to do a file based parsing logic for the same. > > global Num1, Num2 > > Num1 = int(raw_input('First Number: ').rstrip('\n')) > > Num2 = int(raw_input('Second Number: ').rstrip('\n')) > > print "Checking (", num1, ",", num2, ")" > > > > def doConnectivityCheck(Num1, Num2): > > # I have removed the actual code for simplicity > > print "The following 2 numbers are connected (", Num1, ",", Num2, ")" > > > > return > > > > def storeInput(Num1, Num2): > > # I have removed the actual code for simplicity > > print "The following 2 numbers have been stored (", Num1, ",", Num2, > > ")" > > return > > > > def main(): > > userResponseFlag = 1 > > while userResponseFlag: > > userResponse = raw_input('Do you want to check connectivity > between > > 2 given numbers - answer(y/n) only: ') > > if userResponse == 'y': > > captureInput() > > doConnectivityCheck(Num1, Num2) > > storeInput(Num1, Num2) > > elif userResponse == 'n': > > userResponseFlag = 0 > > else: > > print "Your input does not confirm to the y/n rule, fix that > > and retry" > > continue > > > > main() > > =================================================== > > -------------- next part -------------- > > An HTML attachment was scrubbed... > > URL: < > > > http://mail.python.org/pipermail/portland/attachments/20120729/460d0530/attachment.html > > > > > _______________________________________________ > > Portland mailing list > > Portland at python.org > > http://mail.python.org/mailman/listinfo/portland > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/portland/attachments/20120729/07a613d9/attachment.html > > > _______________________________________________ > Portland mailing list > Portland at python.org > http://mail.python.org/mailman/listinfo/portland > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian at python.org Tue Jul 31 17:29:15 2012 From: brian at python.org (Brian Curtin) Date: Tue, 31 Jul 2012 10:29:15 -0500 Subject: [portland] PyCon 2013 is under way! Now accepting proposals Message-ID: It was only a few months ago when we wrapped up the hugely successful PyCon 2012, and we started working on the 2013 conference right away. PyCon 2013 will again be in Santa Clara, California, with tutorials kicking off March 13, the conference March 15, and sprints beginning March 18. Along with our site release at https://us.pycon.org/2013/, we opened our Call for Proposals a month earlier than last year at https://us.pycon.org/2013/speaking/cfp/. We're looking to you, the community, to help us make PyCon 2013 even better. We're accepting proposals through September 28, hoping to break last year's record of 519 talk, tutorial, and poster proposals. We're looking for all types of presentations from all types of people. If you've got a topic to share, we hope you'll submit a proposal. Create an account at https://us.pycon.org/2013/account/signup/, and fill in your speaker profile and submit away! With another record submission period expected, we're also rounding up volunteers for our Program Committee, the team tasked with evaluating the proposals and coming up with the conference schedule. If you're interested in volunteering, join the PyCon Program Committee mailing list and introduce yourself at http://mail.python.org/mailman/listinfo/pycon-pc. Without sponsors, PyCon wouldn't be possible. They're what keep the conference prices low and values high, and we share the same deal with our sponsorship packages. Especially after you factor in the price of tickets that all packages include, we think our sponsorship packages are second to none. We even have a 50% discount for small businesses! Check out https://us.pycon.org/2013/sponsors/whysponsor/ for more info. We've also made changes in how we're doing ticketing, specifically for early bird rates. We even cut our student ticket prices in half, starting at $100! We'll announce more details as we get closer, but know that ticket sales will be opening up in the fall. Be sure to plan accordingly because we anticipate another quick sell out! Be sure to follow us at http://pycon.blogspot.com/ and https://twitter.com/pycon! Jesse Noller - Chairman - jnoller at python.org Brian Curtin - Publicity Coordinator - brian at python.org