I'd like to do something like this; iterate through a file which
consists of data stored in dictionary format, one dict on each line,
and read each line into a new dict using one of the values in the dict
as its name...
for example:
stuff = open('data.txt')
for eachLine in stuff:
name{}
nam
> So the tougher problem seems to be parsing those lines. That is not a
> valid Python dictionary unless the names `Bob`, `Humboldt`, `red`, and
> `predatory` are not already defined. So you can't just ``eval`` it.
In what way? {'key': val}, right?
Anyway, I can always change the format they g
That sounds like a solution. I think the core of the question is as
follows; if I was to call the dict() function for each line, thus
creating a dictionary, and then rename it to dict['name'], will there
be a namespace collision on the next loop when dict() is called again?
Obviously the first dict
On Oct 11, 4:17 pm, Tim Golden <[EMAIL PROTECTED]> wrote:
> jeremito wrote:
> > On Oct 11, 10:43 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> >> jeremito wrote:
> >>> My Python script makes a bunch of images that I want to use as frames
> >>> in a movie. I've tried searching for a module th
Has anyone else experienced a weird SQLite3 problem?
Going by the documentation at docs.python.org, the syntax is as
follows:
foo = sqlite3.connect(dbname) creates a connection object representing
the state of dbname and assigns it to variable foo. If dbname doesn't
exist, a file of that name is c
On Oct 29, 11:51 am, Duncan Booth <[EMAIL PROTECTED]>
wrote:
> TYR <[EMAIL PROTECTED]> wrote:
> > To do anything with it, you then need to create a cursor object by
> > calling foo's method cursor (bar = foo.cursor).
>
> Perhaps this would work better if
Perhaps we need a pythonic FRONTEND.
If you're meant to be able to run java code in a browser vm; and
flash; and javascript...why not a reduced version of python?
I'm thinking a sandboxed interpreter, perhaps based on EmbeddedPython,
and a restricted set of classes; core logic, string and maths,
I have a large dump file that originated in a MySQL db; I need to get
it into an SQLite file.
Various options are suggested around the web; none of them seem to
work (most failing to import the thing in the first place). So I
removed the assorted taggery from each end, leaving just a big text
file
On Nov 23, 4:22 am, SamFeltus <[EMAIL PROTECTED]> wrote:
> """Perhaps we need a pythonic FRONTEND. """
>
> Should have happened years ago.
Python Internet Environment: PIE.
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 29, 3:15 pm, Aaron Watters <[EMAIL PROTECTED]> wrote:
> On Nov 22, 11:22 pm, SamFeltus <[EMAIL PROTECTED]> wrote:
>
> > """Perhaps we need a pythonic FRONTEND. """
>
> > Should have happened years ago.
>
> It did. Mark Hammond embedded Python under MSIE about
> the same time javascript and
A server that runs one of my programs was upgraded to Debian Lenny
last night, which moved it from Python 2.4.4 to 2.5.2. This caused
immediate trouble. At one point, data is parsed from a Web page, and
among other things a time date group is collected. This is in a nice
human readable format, but
On Mar 25, 7:38 pm, MRAB wrote:
> TYR wrote:
> > A server that runs one of my programs was upgraded to Debian Lenny
> > last night, which moved it from Python 2.4.4 to 2.5.2. This caused
> > immediate trouble. At one point, data is parsed from a Web page, and
> > amo
I'm doing some data normalisation, which involves data from a Web site
being extracted with BeautifulSoup, cleaned up with a regex, then
having the current year as returned by time()'s tm_year attribute
inserted, before the data is concatenated with string.join() and fed
to time.strptime().
Here's
On May 29, 2:23 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> TYR wrote:
> > I'm doing some data normalisation, which involves data from a Web site
> > being extracted with BeautifulSoup, cleaned up with a regex, then
> > having the current year
On May 29, 2:24 pm, alex23 <[EMAIL PROTECTED]> wrote:
> On May 29, 11:09 pm, TYR <[EMAIL PROTECTED]> wrote:
>
>
>
> > I'm doing some data normalisation, which involves data from a Web site
> > being extracted with BeautifulSoup, cleaned up with a regex, the
>" b = wx.Button(label="Click Me", action=myCallable)
>Instead you used to have to create a button and then call
>some utility function in some other object to bind that
>button to a callable (IIRC this was one place where Window
>IDs could be used). Now, the button actually
OK, this ought to be simple. I'm parsing a large text file (originally
a database dump) in order to process the contents back into a SQLite3
database. The data looks like this:
'AAA','PF',-17.4167,-145.5,'Anaa, French Polynesia','Pacific/
Tahiti','Anaa';'AAB','AU',-26.75,141,'Arrabury, Que
>How do you propose to parse that string into a "set of values"? Can
>you rely there being data commas only in the 5th field, or do you need
>a general solution? What if (as Peter remarked) there is a ';' in the
>data? What if there's a "'" in the data (think O'Hare)?
My plan was to be pointlessl
On Jun 20, 3:35 pm, Paul McGuire <[EMAIL PROTECTED]> wrote:
> On Jun 20, 6:01 am, TYR <[EMAIL PROTECTED]> wrote:
Thank you very much. This pyparsing module looks damned useful.
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 25, 10:38 am, rodmc <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have been scouting around online for information on how to use
> Python and a GUI toolikit to develop mobile devices. At present I am
> using wxPython for desktop apps and would like to continue using that
> if possible. Anyway, I wo
Who cares? Everyone does their GUI in a browser these days - keep up,
Dad. What we need is a pythonic front end.
/troll
--
http://mail.python.org/mailman/listinfo/python-list
Use csv.DictReader to get a list of dicts (you get one for each row,
with the values as the vals and the column headings as the keys) and
then do a len(list)?
--
http://mail.python.org/mailman/listinfo/python-list
There's always the naive option.
query = ('species', 'lifestyle', 'coolness', 'tentacles=>8')
db.execute('SELECT %s, %s, %s % FROM creatures WHERE %s;' % query)
record = dict(zip((query), (db.fetchall()))
array = '''{
'''
for k,v in record:
array.append('"(k)":"(v)"')
array.append('
On Aug 27, 2:37 pm, TYR <[EMAIL PROTECTED]> wrote:
> There's always the naive option.
>
> query = ('species', 'lifestyle', 'coolness', 'tentacles=>8')
> db.execute('SELECT %s, %s, %s % FROM creatures WH
I have a little application that wants to send data to a Google API.
This API requires an HTTP header to be set as follows:
Authorization: GoogleLogin auth=[value of auth token goes here]
Unfortunately, I'm getting nothing but 400 Bad Requests. I suspect
this is due to an unfeature of urllib2. No
25 matches
Mail list logo