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 -- the
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 t
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
--
https://mail.p
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 i
:-) yeah...
--
http://mail.python.org/mailman/listinfo/python-list
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
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
--
http://mail.
oh DUH! that was it, just missing the -F. Thank-you!!
--
http://mail.python.org/mailman/listinfo/python-list
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
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. Ca
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
>
> > accura
NTFS partition
Windows 7
Python 2.7
--
http://mail.python.org/mailman/listinfo/python-list
>
> >
>
> >
>
> 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
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 f
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
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
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 = datetime.dateti
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("
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 us
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 d
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
--
http://mail.python.org/mailman/listinfo/p
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 looke
On Feb 10, 4:58 am, Arnaud Delobelle wrote:
> On 10 February 2012 06:21, Ian Kelly wrote:
>
>
>
>
>
> > (3219 + 99) // 100 * 100
> >> 3300
> > (3289 + 99) // 100 * 100
> >> 3300
> > (328678 + 99) // 100 * 100
> >> 328700
> > (328 + 99) // 100 * 100
> >> 400
>
> >> Those are all ro
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
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
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
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.
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 data)
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
On Dec 15, 11:36 am, noydb 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
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 is
> 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
--
http://mail.
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
On Aug 25, 4:53 pm, Chris Rebert wrote:
> On Thu, Aug 25, 2011 at 1:38 PM, noydb 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-
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 (thous
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 A
On Aug 18, 11:29 am, Jerry Hill wrote:
> On Thu, Aug 18, 2011 at 11:19 AM, noydb 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 to the files. The
On Aug 18, 11:12 am, David Robinow wrote:
> On Thu, Aug 18, 2011 at 10:57 AM, noydb 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"] int
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
On May 13, 1:25 pm, Mark Niemczyk 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', 'blue',
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
Thanks All for your responses, all a help!
--
http://mail.python.org/mailman/listinfo/python-list
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
On Feb 9, 3:28 pm, Ethan Furman 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
On Feb 9, 3:08 pm, Josh English 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
On Feb 9, 1:21 pm, Josh English 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?
> >
>
> 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 = [
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
On Dec 5, 8:42 am, Steve Holden 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
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
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 = app.Form1.E
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
On Nov 18, 6:20 pm, noydb wrote:
> On Nov 18, 5:54 pm, noydb wrote:
>
>
>
>
>
> > On Nov 18, 5:22 pm, Tim Harig wrote:
>
> > > On 2010-11-18, noydb wrote:
>
> > > > import subprocess
> > > > pig = subprocess.Popen(["C:\Halls\h
On Nov 18, 5:54 pm, noydb wrote:
> On Nov 18, 5:22 pm, Tim Harig wrote:
>
>
>
>
>
> > On 2010-11-18, noydb wrote:
>
> > > import subprocess
> > > pig = subprocess.Popen(["C:\Halls\hallbig2.exe"],
> > > stdin=subprocess.PIPE, stdout
On Nov 18, 5:22 pm, Tim Harig wrote:
> On 2010-11-18, noydb wrote:
>
> > import subprocess
> > pig = subprocess.Popen(["C:\Halls\hallbig2.exe"],
> > stdin=subprocess.PIPE, stdout=subprocess.PIPE)
> > result = pig.communicate(input='C:\Halls\Input\Ea3
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
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 output
On Jun 5, 9:31 pm, Tim Chase 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 da
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.
--
http://mail.python.org/mailman/listinfo/pyth
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
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.
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
On Nov 11, 11:43 am, noydb 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
impo
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
thanks everyone for all the ideas -- simple stuff, I know for you all,
but very helpful for me.
--
http://mail.python.org/mailman/listinfo/python-list
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 se
On May 14, 4:13 pm, Scott David Daniels 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',
> > 'precip_may', 'pre
On May 12, 12:26 pm, John Machin wrote:
> On May 13, 1:58 am, Jaime Fernandez del Rio
> wrote:
>
>
>
>
>
> > On Tue, May 12, 2009 at 5:02 PM, MRAB wrote:
> > > John Machin wrote:
>
> > >> MRAB mrabarnett.plus.com> writes:
>
> > >>> Sort the list, passing a function as the 'key' argument. The fu
On May 11, 11:30 pm, Paul Rubin <http://phr...@nospam.invalid> wrote:
> noydb 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 mo
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 th
On Dec 11, 9:38 pm, "gudonghua+pyt...@gmail.com"
wrote:
> On Dec 12, 10:15 am, noydb 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 o
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 no
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
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 zipf
74 matches
Mail list logo