Re: downloading a CSV

2016-02-19 Thread noydb
Thanks! That was pretty easy. import urllib.request url = 'http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv' urllib.request.urlretrieve(url, csv_file) csv_file = r"C:\Temp\earthquakeAll_last30days.csv" urllib.request.urlretrieve(url, csv_file) I do want to use python --

downloading a CSV

2016-02-19 Thread noydb
Greetings All, Python v 3.4, windows I want to be able to download this CSV file and save to disk >> http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv This (interacting with the web using python) is very new to me, so can anyone provide direction on how to go about doing

extracting zip item to in-memory

2015-05-06 Thread noydb
I have a zip file containing several files and I want to extract out just the .xml file. I have that code. Curious if this xml file can be extracted into memory. If so, how to? I only need to move the file around, and maybe read some tags. Thanks for any help! python 2.7 --

analyzing time

2013-07-05 Thread noydb
Hello All, I have a table with a column of type date, with dates and time combined (like '1/6/2013 3:52:69PM'), that spans many months. How would I pull out records that are the first and last entries per day? Also, if I wanted to find time clusters per day (or per week) -- like if an entry

advice, python for binary to xml

2013-01-31 Thread noydb
I'm looking for knowlegde about how best to go about converting a binary file (from a GPS unit) to GPX/XML. I am completely clueless on this, so any start-from-the-beginning info would be greatly appreciated! I'm guessing the level of effort will be huge? Python 2.7, Windows 7 --

Re: advice, python for binary to xml

2013-01-31 Thread noydb
On Thursday, January 31, 2013 8:41:34 AM UTC-5, Maarten wrote: On Thursday, January 31, 2013 2:33:48 PM UTC+1, noydb wrote: I'm looking for knowlegde about how best to go about converting a binary file (from a GPS unit) to GPX/XML. I am completely clueless on this, so any start-from

Re: advice, python for binary to xml

2013-01-31 Thread noydb
:-) yeah... -- http://mail.python.org/mailman/listinfo/python-list

how to use subprocess to execute an exe with args and an output

2013-01-30 Thread noydb
I am looking for some guidance on using subprocess to execute an EXE with arguments and an output. The below code works in that it returns a 0 exit code, but no output file is created. I have tried a few different versions of this code (used Popen instead, some stderr/stdout), but no luck.

Re: how to use subprocess to execute an exe with args and an output

2013-01-30 Thread noydb
To add on, I need to eventually write a script that takes input, feeds it into this exe, and takes the output file to perform more 'tools'/manipulations on it. Is call or Popen called for, why? Or maybe some other module??? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to use subprocess to execute an exe with args and an output

2013-01-30 Thread noydb
oh DUH! that was it, just missing the -F. Thank-you!! -- http://mail.python.org/mailman/listinfo/python-list

Re: strptime - dates formatted differently on different computers

2012-12-11 Thread noydb
On Tuesday, December 11, 2012 3:35:29 AM UTC-5, Greg Donald wrote: On Mon, Dec 10, 2012 at 10:34:31PM -0700, Michael Torrie wrote: I use a module I got from pypi called dateutil. It has a nice submodule called parser that can handle a variety of date formats with good accuracy. Not

date-time comparison, aware vs naive

2012-12-10 Thread noydb
I want to compare a user entered date-and-time against the date-and-time of a pdf file. I posted on this (how to get a file's date-time) before, was advised to do it like: import datetime, os, stat mtime = os.lstat(filename)[stat.ST_MTIME] // the files modification time dt =

Re: date-time comparison, aware vs naive

2012-12-10 Thread noydb
Found this, and it solved my problem http://blogs.law.harvard.edu/rprasad/2011/09/21/python-string-to-a-datetime-object/ -- http://mail.python.org/mailman/listinfo/python-list

Re: date-time comparison, aware vs naive

2012-12-10 Thread noydb
On Monday, December 10, 2012 3:52:55 PM UTC-5, Steven D'Aprano wrote: On Mon, 10 Dec 2012 11:57:37 -0800, noydb wrote: I want to compare a user entered date-and-time against the date-and-time of a pdf file. I posted on this (how to get a file's date-time) before, was advised

strptime - dates formatted differently on different computers

2012-12-10 Thread noydb
Follow-on question to this earlier topic - https://groups.google.com/d/topic/comp.lang.python/wnUlPBBNah8/discussion Was curious to know if there was a way to handle different user computers with different operating system set date formats. 2/10/2006 vs 2-10-2006, for example. Not an issue

Re: date-time comparison, aware vs naive

2012-12-10 Thread noydb
http://docs.python.org/2/library/datetime An object of type *time* or *datetime* may be naive or *aware aware refers to time-zone and daylight savings time, such political ephemerals. Two times can only be changed if one knows they're both in the same one, or if one

Re: strptime - dates formatted differently on different computers

2012-12-10 Thread noydb
NTFS partition Windows 7 Python 2.7 -- http://mail.python.org/mailman/listinfo/python-list

date and time comparison how to

2012-10-29 Thread noydb
All, I need help with a date and time comparison. Say a user enters a date-n-time and a file on disk. I want to compare the date and time of the file to the entered date-n-time; if the file is newer than the entered date-n-time, add the file to a list to process. How best to do? I have

Re: date and time comparison how to

2012-10-29 Thread noydb
Thanks, I did find this... pdf_timeStamp = time.strftime(%m%d%y%H%M%S,time.localtime(os.path.getmtime(pdf))) pdf_timestamp '102909133000' ... but now how to do the comparison? Cannot just do a raw string comparison, gotta declare it a date --

Re: date and time comparison how to

2012-10-29 Thread noydb
if I do time.time() I get 1351562187.757, do it again I get 1351562212.2650001 --- so I can compare those, the latter is later then the former. Good. SO how do I turn pdf_timeStamp (a string) above into time in this (as from time.time()) format? Am I on the right track -- is that the way to

Re: date and time comparison how to

2012-10-29 Thread noydb
I guess I get there eventually! This seems to work pdf_timeStamp = time.strftime(%m%d%y%H%M%S,time.localtime(os.path.getmtime(pdf))) intermediateTime = time.strptime(pdf_timeStamp, %m%d%y%H%M%S) pdfFile_compareTime = time.mktime(intermediateTime) (and I'll do the same to the user

Re: date and time comparison how to

2012-10-29 Thread noydb
On Monday, October 29, 2012 11:11:55 PM UTC-4, Dave Angel wrote: On 10/29/2012 10:13 PM, noydb wrote: I guess I get there eventually! This seems to work pdf_timeStamp = time.strftime(%m%d%y%H%M%S,time.localtime(os.path.getmtime(pdf))) intermediateTime

Re: round down to nearest number

2012-02-10 Thread noydb
On Feb 10, 4:58 am, Arnaud Delobelle arno...@gmail.com wrote: On 10 February 2012 06:21, Ian Kelly ian.g.ke...@gmail.com wrote: (3219 + 99) // 100 * 100 3300 (3289 + 99) // 100 * 100 3300 (328678 + 99) // 100 * 100 328700 (328 + 99) // 100 * 100 400 Those are all rounded

Formate a number with commas

2012-02-09 Thread noydb
How do you format a number to print with commas? Some quick searching, i came up with: import locale locale.setlocale(locale.LC_ALL, ) locale.format('%d', 2348721, True) '2,348,721' I'm a perpetual novice, so just looking for better, slicker, more proper, pythonic ways to do this. Thanks!

round down to nearest number

2012-02-09 Thread noydb
How do you round down ALWAYS to nearest 100? Like, if I have number 3268, I want that rounded down to 3200. I'm doing my rounding like round(3268, -2) But, how to round DOWN? -- http://mail.python.org/mailman/listinfo/python-list

Re: round down to nearest number

2012-02-09 Thread noydb
hmmm, okay. So how would you round UP always? Say the number is 3219, so you want 3300 returned. -- http://mail.python.org/mailman/listinfo/python-list

Re: round down to nearest number

2012-02-09 Thread noydb
That { (3219 + 99) // 100} doesnt work if the number is other then 4 digits. (for rounding up to nearest 100): (3219 + 99)//100 33 (3289 + 99)//100 33 (328678 + 99)//100 3287 (328 + 99)//100 4 -- http://mail.python.org/mailman/listinfo/python-list

building a dictionary dynamically

2012-02-06 Thread noydb
How do you build a dictionary dynamically? Doesn't seem to be an insert object or anything. So I need an empty dictionary that I then want to populate with values I get from looping through a list and grabbing some properties. So simply, I have (fyi, arcpy = module for interacting with gis

test for list equality

2011-12-15 Thread noydb
I want to test for equality between two lists. For example, if I have two lists that are equal in content but not in order, I want a return of 'equal' -- dont care if they are not in the same order. In order to get that equality, would I have to sort both lists regardless? if yes, how (having

Re: test for list equality

2011-12-15 Thread noydb
On Dec 15, 11:36 am, noydb jenn.du...@gmail.com wrote: I want to test for equality between two lists.  For example, if I have two lists that are equal in content but not in order, I want a return of 'equal' -- dont care if they are not in the same order.  In order to get that equality, would I

Re: test for list equality

2011-12-15 Thread noydb
Ahh, I see (on the sort issue), thanks All! Still, any other slicker ways to do this? Just for learning. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to make fxn argument work with setting a field value

2011-09-08 Thread noydb
The documentation mentions getValue and setValue: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z00...- Hide quoted text - - Show quoted text - I have tried row.setValue(rankFld) = i for line 14. Get syntax error - cant assign to function call --

Re: Adding a ranking based on two fields

2011-09-07 Thread noydb
On Aug 25, 4:53 pm, Chris Rebert c...@rebertia.com wrote: On Thu, Aug 25, 2011 at 1:38 PM, noydb jenn.du...@gmail.com wrote: Hello All, Looking for some advice/ideas on how to implement arankingto a 'scores' field I have.  So this scores field has values ranging from 1.00-4

how to make fxn argument work with setting a field value

2011-09-07 Thread noydb
What do I need to do to line 14 code below to get it to recognize the field name and not the argument name? I get this error with below code at line 13, the print row.rankFld line RuntimeError: Row: Field rankFld does not exist A field called rankFld does not, should not exist. rankFld is RANKa

Adding a ranking based on two fields

2011-08-25 Thread noydb
Hello All, Looking for some advice/ideas on how to implement a ranking to a 'scores' field I have. So this scores field has values ranging from 1.00-4. There is also a count field. I want to add a rank field such that all the records have a unique ranking, 1 through the number of records

Re: How to convert a list of strings into a list of variables

2011-08-19 Thread noydb
Thanks to all for your responses! Good lessons. I implemented something like what Jerry Hill suggested (dictionary), which works well for my purposes. The list of strings that is being passed into this code is also provided by something I wrote so I do trust what is being sent. Might use what

How to convert a list of strings into a list of variables

2011-08-18 Thread noydb
How would you convert a list of strings into a list of variables using the same name of the strings? So, [red, one, maple] into [red, one, maple] Thanks for any help! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert a list of strings into a list of variables

2011-08-18 Thread noydb
On Aug 18, 11:12 am, David Robinow drobi...@gmail.com wrote: On Thu, Aug 18, 2011 at 10:57 AM, noydb jenn.du...@gmail.com wrote: How would you convert a list of strings into a list of variables using the same name of the strings? So, [red, one, maple] into [red, one, maple]   Why would

Re: How to convert a list of strings into a list of variables

2011-08-18 Thread noydb
On Aug 18, 11:29 am, Jerry Hill malaclyp...@gmail.com wrote: On Thu, Aug 18, 2011 at 11:19 AM, noydb jenn.du...@gmail.com wrote: I am being passed the list of strings.  I have variables set up already pointing to files.  I need to loop through each variable in the list and do things

How best to convert a string list to a python list

2011-05-13 Thread noydb
I want some code to take the items in a semi-colon-delimted string list and places each in a python list. I came up with below. In the name of learning how to do things properly, do you experts have a better way of doing it? Thanks for any inputs! *** x = red;blue;green;yellow ## string of

Re: How best to convert a string list to a python list

2011-05-13 Thread noydb
On May 13, 1:25 pm, Mark Niemczyk praham...@gmail.com wrote: There are a series of built-in methods for string objects; including the split method which will accomplish exactly the result you are looking for. x = red;blue;green;yellow color_list = x.split(';') color_list ['red',

Re: Two random lists from one list

2011-03-18 Thread noydb
Thanks All for your responses, all a help! -- http://mail.python.org/mailman/listinfo/python-list

Two random lists from one list

2011-03-11 Thread noydb
Hello All, I am just looking to see if there is perhaps a more efficient way of doing this below (works -- creates two random teams from a list of players). Just want to see what the experts come up with for means of learning how to do things better. Thanks for any responses! ### import random

Re: frequency of values in a field

2011-02-09 Thread noydb
The Decimal module is pretty slow but is conceptually probably the right way to do this.  With just 50k records it shouldn't be too bad.  With more records you might look for a faster way.     from decimal import Decimal as D     from collections import defaultdict     records =

Re: frequency of values in a field

2011-02-09 Thread noydb
On Feb 9, 1:21 pm, Josh English joshua.r.engl...@gmail.com wrote: On Wednesday, February 9, 2011 9:52:27 AM UTC-8, noydb wrote: So it seems the idea is to add all the records in the particular field of interest into a list (record).  How does one do this in pure Python? Normally in my

Re: frequency of values in a field

2011-02-09 Thread noydb
On Feb 9, 3:08 pm, Josh English joshua.r.engl...@gmail.com wrote: On Wednesday, February 9, 2011 10:34:12 AM UTC-8, noydb wrote: How do you add all the records in the particular field of interest into long_list? Sorry to be unclear. In both cases I was tossing out pseudo-code, as I am

Re: frequency of values in a field

2011-02-09 Thread noydb
On Feb 9, 3:28 pm, Ethan Furman et...@stoneleaf.us wrote: noydb wrote:   Paul Rubin wrote: The Decimal module is pretty slow but is conceptually probably the right way to do this.  With just 50k records it shouldn't be too bad.  With more records you might look for a faster way

frequency of values in a field

2011-02-08 Thread noydb
I am looking for ways to go about capturing the frequency of unique values in one field in a dbf table which contains ~50k records. The values are numbers with atleast 5 digits to the right of the decimal, but I want the frequency of values to only 2 decimal places. I do have a method to do this

Re: How to add data into exisitng Excel file at next open row?

2010-12-05 Thread noydb
On Dec 5, 8:42 am, Steve Holden st...@holdenweb.com wrote: On 12/3/2010 6:21 PM, noydb wrote: How can you determine the next open row in an existing Excel file such that you can start adding data to the cells in that row?  As in below, I want a variable in place of the 6 (row 6

How to add data into exisitng Excel file at next open row?

2010-12-03 Thread noydb
How can you determine the next open row in an existing Excel file such that you can start adding data to the cells in that row? As in below, I want a variable in place of the 6 (row 6 in the four ws1.Cells(x,1) lines), but have no other way of knowing what row I am on besides looking to the first

Re: How to run an EXE, with argument, capture output value

2010-11-19 Thread noydb
Any other help? I am guessing not, just wanted to try one more time. Could really use help, please!! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to run an EXE, with argument, capture output value

2010-11-19 Thread noydb
Thanks to Jerry Hill above who helped. This worked: from pywinauto.application import Application app = Application() app.start_(r'C:\temp\hallbig2.exe') app.Form1.Edit6.TypeKeys(r'C:\temp\input\Ea39j.txt') E_Value = while (E_Value == ): app.Form1.Compute.Click() E_Value =

Re: How to run an EXE, with argument, capture output value

2010-11-18 Thread noydb
I will use 2.5. I tried your suggestion, with this code import subprocess pig = subprocess.Popen([C:\Halls\hallbig2.exe], stdin=subprocess.PIPE, stdout=subprocess.PIPE) result = pig.communicate(input='C:\Halls\Input\Ea39j.txt')[-1] #I need to capture the, what I think is the, last output print

Re: How to run an EXE, with argument, capture output value

2010-11-18 Thread noydb
On Nov 18, 5:22 pm, Tim Harig user...@ilthio.net wrote: On 2010-11-18, noydb jenn.du...@gmail.com wrote: import subprocess pig = subprocess.Popen([C:\Halls\hallbig2.exe], stdin=subprocess.PIPE, stdout=subprocess.PIPE) result = pig.communicate(input='C:\Halls\Input\Ea39j.txt')[-1] #I need

Re: How to run an EXE, with argument, capture output value

2010-11-18 Thread noydb
On Nov 18, 5:54 pm, noydb noyd...@gmail.com wrote: On Nov 18, 5:22 pm, Tim Harig user...@ilthio.net wrote: On 2010-11-18, noydb jenn.du...@gmail.com wrote: import subprocess pig = subprocess.Popen([C:\Halls\hallbig2.exe], stdin=subprocess.PIPE, stdout=subprocess.PIPE) result

Re: How to run an EXE, with argument, capture output value

2010-11-18 Thread noydb
On Nov 18, 6:20 pm, noydb noyd...@gmail.com wrote: On Nov 18, 5:54 pm, noydb noyd...@gmail.com wrote: On Nov 18, 5:22 pm, Tim Harig user...@ilthio.net wrote: On 2010-11-18, noydb jenn.du...@gmail.com wrote: import subprocess pig = subprocess.Popen([C:\Halls\hallbig2.exe

How to run an EXE, with argument, capture output value

2010-11-17 Thread noydb
Hello All, I would appreciate some guidance on this. I'm a newbe, sorry if I sound dumb - I kind of am on this stuff! I have an executable that I want to run within python code. The exe requires an input text file, the user to click a 'compute' button, and then the exe calculates several

Re: save xls to csv/dbf without Excel/win32com.client

2010-06-06 Thread noydb
On Jun 5, 9:31 pm, Tim Chase python.l...@tim.thechases.com wrote: On 06/05/2010 06:47 PM, noydb wrote: Is there a way to save a .xls file (the first worksheet) as a .dbf or .csv without opening an instance of Excel with win32com.client (been awhile, is this the best module these days

save xls to csv/dbf without Excel/win32com.client

2010-06-05 Thread noydb
Is there a way to save a .xls file (the first worksheet) as a .dbf or .csv without opening an instance of Excel with win32com.client (been awhile, is this the best module these days for v2.5)? In case a computer does not have Excel (2007) installed. --

Rounding up to the next 100

2010-01-21 Thread noydb
If one has a floating number as a string, is there a spiffy way to round that string-number UP to the nearest 100? XstrNmbr = 3579.127893 -- would want to round that to 3600. Thanks for any help! -- http://mail.python.org/mailman/listinfo/python-list

Re: Rounding up to the next 100

2010-01-21 Thread noydb
On Jan 21, 4:30 pm, michael.coll-ba...@verizonwireless.com wrote: From: noydb If one has a floating number as a string, is there a spiffy way to round that string-number UP to the nearest 100? XstrNmbr = 3579.127893 -- would want to round that to 3600. What's wrong with round?  round

Re: Rounding up to the next 100

2010-01-21 Thread noydb
Sorry, although what I really need is the string-number rounded UP every time. So if the number is 3890.32, it needs to go to 3900; if the number is 3811.345, it needs to go to 3900 also. So, Florian's answer works. -- http://mail.python.org/mailman/listinfo/python-list

Pause a script before termination

2009-11-11 Thread noydb
Hi All, I want to pause my script before it terminates, just so a user can have a moment to read some print statements I include at the end. How can this be accomplished? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Pause a script before termination

2009-11-11 Thread noydb
On Nov 11, 11:43 am, noydb jenn.du...@gmail.com wrote: Hi All, I want to pause my script before it terminates, just so a user can have a moment to read some print statements I include at the end.  How can this be accomplished? Thanks! Never mind, duh, found my answer now import time

string character count

2009-06-30 Thread noydb
If I have a string for a file name such that I want to find the number of characters to the left of the dot, how can that be done? I did it this way: x = text12345.txt dot = x.find('.') print dot Was curious to see what method others would use - helps me learn. I guess I was most curious to see

Re: putting date strings in order

2009-05-14 Thread noydb
On May 12, 12:26 pm, John Machin sjmac...@lexicon.net wrote: On May 13, 1:58 am, Jaime Fernandez del Rio jaime.f...@gmail.com wrote: On Tue, May 12, 2009 at 5:02 PM, MRAB goo...@mrabarnett.plus.com wrote: John Machin wrote: MRAB google at mrabarnett.plus.com writes: Sort the

Re: putting date strings in order

2009-05-14 Thread noydb
On May 14, 4:13 pm, Scott David Daniels scott.dani...@acm.org wrote: Peter Otten wrote: Hm, if ordered_raster_list is guaranteed to contain one string item for every month the above can be simplified to months = [     'precip_jan', 'precip_feb', 'precip_mar', 'precip_apr',    

Re: putting date strings in order

2009-05-12 Thread noydb
On May 11, 11:30 pm, Paul Rubin http://phr...@nospam.invalid wrote: noydb jenn.du...@gmail.com writes: Anyone have any good ideas?  I was curious to see what people came up with. Is this a homework assignment?  Some hints: 1) figure out how to compare two month names for chronological

putting date strings in order

2009-05-11 Thread noydb
All, How best to go about this? I have a list containing strings referring to months, like [x_apr, x_jul, x_jan, x_aug, x_may, etc] -- always using the 3-chars for month. The list will contain all 12 months, however the starting month may not necessarily be jan. I want to order the list

Rename of .mdb file -- lock

2008-12-11 Thread noydb
All, I have the code below, which unzips a zipfile containing only one file. Once it is unzipped, I want to rename the file based on a user provided name. But I get this (WindowsError: [Error 32] The process cannot access the file because it is being used by another process) error, which does

Re: Rename of .mdb file -- lock

2008-12-11 Thread noydb
On Dec 11, 9:38 pm, gudonghua+pyt...@gmail.com gudong...@gmail.com wrote: On Dec 12, 10:15 am, noydb jenn.du...@gmail.com wrote: All, I have the code below, which unzips a zipfile containing only one file.  Once it is unzipped, I want to rename the file based on a user provided name

simple UnZip

2008-07-02 Thread noydb
Can someone help me with this script, which I found posted elsewhere? I'm trying to figure out what is going on here so that I can alter it for my needs, but the lack of descriptive names is making it difficult. And, the script doesn't quite do anything worthwhile -- it unzips one file from a

Re: simple UnZip

2008-07-02 Thread noydb
On Jul 2, 10:07 am, Cédric Lucantis [EMAIL PROTECTED] wrote: Le Wednesday 02 July 2008 15:39:51 noydb, vous avez écrit : Can someone help me with this script, which I found posted elsewhere? I'm trying to figure out what is going on here so that I can alter it for my needs