I am trying to use the dictionary reader to import the data from a csv
file and create a dictnary from it but just can't seem to figure it
out.
Here is my code:
>>>import csv
>>>reader = csv.DictReader(open('table.csv'))
>>>for row in reader:
>>>print row
my csv files looks like this:
Bytecode,E
are there any python modules for manipulation of .reg files producted
by
the win32 prog "reg".
thanks.
black_13
--
http://mail.python.org/mailman/listinfo/python-list
Wow -- thanks, guys. And who said Python only gives you one way to do
things. :-) Metaclasses, globals(), and __subclasses__. Thank Duncan
for the __subclassess__ tip -- I didn't know about that.
I'd totally overlooked globals(). It's exactly what I was looking for
-- thanks, Peter. And I like yo
On Mar 19, 1:14 pm, black_13 <[EMAIL PROTECTED]> wrote:
> are there any python modules for manipulation of .reg files producted
> by
> the win32 prog "reg".
> thanks.
> black_13
The *.reg files are text files, so you can parse them like any text
file. You can just edit the Windows Registry directl
On Mar 19, 1:06 pm, brnstrmrs <[EMAIL PROTECTED]> wrote:
> I am trying to use the dictionary reader to import the data from a csv
> file and create a dictnary from it but just can't seem to figure it
> out.
>
> Here is my code:
>
> >>>import csv
> >>>reader = csv.DictReader(open('table.csv'))
> >>>
I am new to Python and I am writing a script to build a XML document
and post it to a website. I have a working script but need to insert
a DTD statement in my XML document and can't find out how to do this.
I am using "from xml.dom.minidom import Document"
Some code I am using is:
doc =
On Mar 19, 2:32 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote:
> On Mar 19, 1:06 pm, brnstrmrs <[EMAIL PROTECTED]> wrote:
>
>
>
> > I am trying to use the dictionary reader to import the data from a csv
> > file and create a dictnary from it but just can't seem to figure it
> > out.
>
> > Here is my
Alex9968 wrote:
> Is it possible to get position (in numbers) of the insertion cursor? As
> I understood, Text widget uses mark named INSERT to store it, which is
> available globally by just referencing INSERT, but how could I get
> actual coordinate numbers of the mark?
> I need this because I
En Wed, 19 Mar 2008 04:28:19 -0300, bharath venkatesh
<[EMAIL PROTECTED]> escribió:
> handling SIGTERM allowed me to do cleaning up while the system shuts
> down
> but as i mentioned previously how can my process know if the system
> was
> not shut down properly previously
Sorry about t
Hi,
i am writing a simple parser, that generates tokens. The parser needs to
maintain some state, because some parts of the file consist of different
tokens. I thought the object could simply remember its state by assigning
it's next() method to the method that is currently parsing. When the st
En Wed, 19 Mar 2008 04:05:50 -0300, purple <[EMAIL PROTECTED]> escribió:
> Could you guys do me a favor for solving a equation set?
>
> Z=d/4*(1-SIN(X)/X)
> X=8q/(D^2*Y)+SIN(X)
> Y=1/n*Z^(2/3)*i^(1/2)
>
> In this equation set, X,Y&Z are the unkown parameters, the others say,
> d, q, n&i are known.
When I'm running Script Editor, I can get Maya to draw a sphere by
typing:
tell application "Maya"
execute "sphere"
end tell
When I try this using Python, I get this error message:
IDLE 1.2.2
>>> app('Maya').execute('sphere')
Traceback (most recent call last):
File "", line 1, in
On Mar 19, 1:55 pm, brnstrmrs <[EMAIL PROTECTED]> wrote:
> On Mar 19, 2:32 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Mar 19, 1:06 pm, brnstrmrs <[EMAIL PROTECTED]> wrote:
>
> > > I am trying to use the dictionary reader to import the data from a csv
> > > file and create a dictnary
En Wed, 19 Mar 2008 07:07:50 -0300, Tim Chase
<[EMAIL PROTECTED]> escribió:
>> Are there any simillar key combination in Python Shell like Linux Ctrl+R
>> (reverse-i-search) to search the command history?
>
> It must depend on how your version of Python was built...mine
> here on my Linux box ha
[EMAIL PROTECTED] wrote:
> When I'm running Script Editor, I can get Maya to draw a sphere by
> typing:
>
> tell application "Maya"
> execute "sphere"
> end tell
>
> When I try this using Python, I get this error message:
>
> IDLE 1.2.2
app('Maya').execute('sphere')
>
> Traceback (mo
On Mar 19, 11:17 pm, Godzilla <[EMAIL PROTECTED]> wrote:
> Hi John,
>
> I am using time.clock to calculate the elapsed time. Below is an
> example of what I was trying to do:
>
> import time
> import thread
Silly me, not being able to infer that from your initial post!
[snip]
>
> But the time.clo
Nicholas F. Fabry schrieb:
> This is a query for information as to how to proceed. I am not a
> professional programmer, but I use Python a great deal to help me in
> my main job, which involves designing schedules for a global airline.
> As such, I use datetime (and dateutil) extensively,
On Wed, 19 Mar 2008 17:59:40 +0100, sam wrote:
> Can someone tell me why class-based OO is better that Prototype based,
> especially in scripting langage with dynamic types as Python is?
Is it better!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-lis
On 19 Mar, 09:44, Torsten Bronger <[EMAIL PROTECTED]>
wrote:
> Could you elaborate on this? (Sincere question; I have almost no
> idea of Haskell.)
If you already know Python, you will find Whitespace just as useful as
Haskell.
--
http://mail.python.org/mailman/listinfo/python-list
Wilbert Berendsen wrote:
> Hi,
>
> i am writing a simple parser, that generates tokens. The parser needs to
> maintain some state, because some parts of the file consist of different
> tokens. I thought the object could simply remember its state by assigning
> it's next() method to the method tha
hello,
by accident I typed a double value test,
and to my surprise it seems to work.
Is this valid ?
a = 2
b = 2
a == b == 2
thanks,
Stef Mientki
--
http://mail.python.org/mailman/listinfo/python-list
Was looking at PEP 3108, http://www.python.org/dev/peps/pep-3108/ ,
and saw that the repr module was slated for vaporization. I've only
used the module a few times ever. I'm curious if the community wants
it kept around or whether it is considered clutter.
The PEP is going to be finalized soon,
On Mar 19, 4:18 pm, Stef Mientki <[EMAIL PROTECTED]> wrote:
> hello,
>
> by accident I typed a double value test,
> and to my surprise it seems to work.
> Is this valid ?
>
> a = 2
> b = 2
>
> a == b == 2
>
> thanks,
> Stef Mientki
It sure looks that way...
See http://www.python.org/doc/2.3.5/ref
Stef Mientki wrote:
> hello,
>
> by accident I typed a double value test,
> and to my surprise it seems to work.
> Is this valid ?
>
> a = 2
> b = 2
>
> a == b == 2
>
> thanks,
> Stef Mientki
>
>
Yes. It's been in Python since the earliest days. You usually see it
in test like this:
if a <
Thanks Diez, I found some docs and examples on urllib2. Now how do i
search the string I get from urllib2, lets say I put it in "myURL", How
do I search for only Numbers and ".'s" in the "#.#.#.#" pattern. That
is all I am interested in with all the data retrieved. Just the IP
Address from a
On Mar 19, 2008, at 16:30, Christian Heimes wrote:
> Nicholas F. Fabry schrieb:
>> This is a query for information as to how to proceed. I am not a
>> professional programmer, but I use Python a great deal to help me
>> in my main job, which involves designing schedules for a global
>> ai
Program randomly aborts when looking up url. The program loop thru
4000+ records looking
up ID via internet and returns html code which is used in subsequent
processing. The code
for looking-up record is below followed by abort details. Can anyone
help with catching the
abort before program aborts
On Mar 19, 10:08 am, sturlamolden <[EMAIL PROTECTED]> wrote:
> On 18 Mar, 23:45, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>
> > > def nonunique(lst):
> > >slst = sorted(lst)
> > >dups = [s[0] for s in
> > > filter(lambda t : t[0] == t[1], zip(slst[:-1],slst[1:]))]
> > >return
"sturlamolden" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| On 19 Mar, 09:40, grbgooglefan <[EMAIL PROTECTED]> wrote:
|
| > How do I create hash map in Python?
|
| Python dictionaries are the fastest hash maps known to man.
If you only have keys (the names) and no values attache
On Mar 20, 8:18 am, Stef Mientki <[EMAIL PROTECTED]> wrote:
> hello,
>
> by accident I typed a double value test,
> and to my surprise it seems to work.
> Is this valid ?
>
> a = 2
> b = 2
>
> a == b == 2
>
Of course. You can chain comparisons as much as you like and is
(semi-)sensible, e.g.
asse
Nicholas F. Fabry schrieb:
> Thank you for the prompt response and suggestion! I am writing up a
> proposal presently. There are, however, two broad category of changes
> - the 'easy' changes, which could be accomplished with little
> additional effort, and the 'hard' changes, which would r
On 19 Mar, 22:48, John Machin <[EMAIL PROTECTED]> wrote:
> I'd use Raymond Hettinger's solution. It is as much O(N) as Paul's,
> and is IMHO more readable than Paul's.
Is a Python set implemented using a hash table?
--
http://mail.python.org/mailman/listinfo/python-list
Is it possible there is some bad data in the larger db? This is asinine, but
maybe write a small script that adds some data, then opens and closes the
db, then repeats this. If this is a size issue, then you can at least narrow
it down to where the size limit is? And, if it isn't you should be a
Hi,
I have a float array ( eg [-1.3, 1.22, 9.2, None, 2.3] ) but there are
many missing vlaues which are represented as None. I would like to
remove all such instances in one go.
There is a remove function but it removes only the first instance, is
there a delete/remove all function?
thanks
--
htt
En Wed, 19 Mar 2008 08:16:52 -0300, Beema shafreen
<[EMAIL PROTECTED]> escribió:
> i am trying to print the dictionary values and tuple in a same line as
> below
>
> print "\t".join(dict[a].values())+'\t'+"\t".join(b)
>
> Error I get is the TypeError,
> since i have misisng values in the di
On Wed, 19 Mar 2008 17:40:39 -0400, Nicholas F. Fabry wrote:
> To summarize my proposal VERY briefly:
>
>
> - Make aware datetime objects display in local time, but calculate/
> compare in UTC.
Your proposal is ambiguous. What does that mean? Can you give an example?
> - Raise exceptions wh
On Wed, Mar 19, 2008 at 10:28 PM, Lee Sander <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a float array ( eg [-1.3, 1.22, 9.2, None, 2.3] ) but there are
> many missing vlaues which are represented as None. I would like to
> remove all such instances in one go.
> There is a remove function but it
Lee Sander <[EMAIL PROTECTED]> writes:
> Hi,
> I have a float array ( eg [-1.3, 1.22, 9.2, None, 2.3] ) but there are
> many missing vlaues which are represented as None. I would like to
> remove all such instances in one go.
> There is a remove function but it removes only the first instance, is
On Wed, 19 Mar 2008 14:45:39 -0700, Jim wrote:
> Program randomly aborts when looking up url. The program loop thru
> 4000+ records looking
> up ID via internet and returns html code which is used in subsequent
> processing. The code
> for looking-up record is below followed by abort details. Can
"Wilbert Berendsen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Hi,
|
| i am writing a simple parser, that generates tokens. The parser needs to
| maintain some state, because some parts of the file consist of different
| tokens. I thought the object could simply remember its st
On Mar 19, 2:48 pm, John Machin <[EMAIL PROTECTED]> wrote:
> On Mar 19, 10:08 am, sturlamolden <[EMAIL PROTECTED]> wrote:
>
>
>
> > On 18 Mar, 23:45, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>
> > > > def nonunique(lst):
> > > >slst = sorted(lst)
> > > >dups = [s[0] for s in
> > > >
On Mar 20, 9:57 am, Justin Bozonier <[EMAIL PROTECTED]> wrote:
> On Mar 19, 2:48 pm, John Machin <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Mar 19, 10:08 am, sturlamolden <[EMAIL PROTECTED]> wrote:
>
> > > On 18 Mar, 23:45, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
>
> > > > > def nonunique(lst):
>
En Wed, 19 Mar 2008 12:44:05 -0300, <[EMAIL PROTECTED]> escribió:
> The csv module contains a Sniffer class which is supposed to deduce the
> delimiter and quote character as well as the presence or absence of a
> header
> in a sample taken from the start of a purported CSV file. I no longer
>
On Mar 20, 9:14 am, sturlamolden <[EMAIL PROTECTED]> wrote:
> On 19 Mar, 22:48, John Machin <[EMAIL PROTECTED]> wrote:
>
> > I'd use Raymond Hettinger's solution. It is as much O(N) as Paul's,
> > and is IMHO more readable than Paul's.
>
> Is a Python set implemented using a hash table?
What don't
hi,
i have a list and i can get elements form it via slicing
L[start:stop]
but sometimes the start is > stop i.e. I want to go in the opposite
direction,eg
L[10:2],
mattab lets you do L(10:-1:2) to achive this, is there a way to do
this in python?
thanks
L
--
http://mail.python.org/mailman/listin
On Mar 19, 9:30 pm, geert <[EMAIL PROTECTED]> wrote:
> On Mar 19, 2:26 am, Graham Dumpleton <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > On Mar 19, 9:47 am, geert <[EMAIL PROTECTED]> wrote:
>
> > > On Mar 18, 6:56 pm, geert <[EMAIL PROTECTED]> wrote:
>
> > > > On Mar 14, 1:15 pm, [EMAIL PROTECTED] wrote:
En Wed, 19 Mar 2008 13:01:08 -0300, Alexandru Dumitrescu
<[EMAIL PROTECTED]> escribió:
> Is there a way to add a new line at the beginning of a *.csv file,
> line which contain the name of the columns?
Once the file was written? You have to create another file, write the
headings, and copy
Hi all
I have an svg file i'm creating on the fly. How do I add the doctype and xml
pi? They're not an element per se, and there is no function to add them. Am
I suppose to add them as elements after all?
I have something like this:
self.svgRoot = ET.Element("svg", xmlns=r'http://www.w3.org/2000
On Mar 19, 2:40 am, grbgooglefan <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a situation that I need to search a name in a big list of names
> in my Python embedded interpreter. I am planning to use hash map for
> quicker search.
> How do I create hash map in Python?
> Can you please guide me to some
En Wed, 19 Mar 2008 13:17:01 -0300, Blubaugh, David A.
<[EMAIL PROTECTED]> escribió:
> Has anyone worked with a translator that will translate python to c/c++
> source code? I know that there is already one translator of this nature
> (shedskin compiler) out there. However, it is still in the
On Mar 19, 6:37 pm, Lee Sander <[EMAIL PROTECTED]> wrote:
> hi,
> i have a list and i can get elements form it via slicing
> L[start:stop]
> but sometimes the start is > stop i.e. I want to go in the opposite
> direction,eg
> L[10:2],
>
> mattab lets you do L(10:-1:2) to achive this, is there a way
Thanks! I will give it a try. It seems though that I get stuck on
rs.Open that makes no sense. I was wondering about pagesize or other
registry settings that might cause this? Will try to track down any
bad data first...
gg
On Mar 19, 3:27 pm, "dsavitsk" <[EMAIL PROTECTED]> wrote:
> Is it possible
On 20 Mar, 00:16, John Machin <[EMAIL PROTECTED]> wrote:
> What don't you understand about the comments in the first two
> screenfuls of Objects/setobject.c?
I had not looked at it, but now I have. Is seems Hettinger is the
author :) Ok, so sets are implemented as hash tables. Then I agree,
use R
On Mar 19, 2008, at 18:32, Steven D'Aprano wrote:
On Wed, 19 Mar 2008 17:40:39 -0400, Nicholas F. Fabry wrote:
To summarize my proposal VERY briefly:
- Make aware datetime objects display in local time, but calculate/
compare in UTC.
Your proposal is ambiguous. Wha
En Wed, 19 Mar 2008 15:33:19 -0300, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> escribió:
> I am new to Python and I am writing a script to build a XML document
> and post it to a website. I have a working script but need to insert
> a DTD statement in my XML document and can't find out how to do thi
On Wed, 19 Mar 2008 12:34:34 +, Duncan Booth wrote:
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>
>> This whole approach
>> assumes that Windows does the sensible thing of returning a unique
> error
>> code when you try to open a file for reading that is already open for
>> writing.
>>
>>
En Wed, 19 Mar 2008 20:16:36 -0300, John Machin <[EMAIL PROTECTED]>
escribió:
> On Mar 20, 9:14 am, sturlamolden <[EMAIL PROTECTED]> wrote:
>> Is a Python set implemented using a hash table?
>
> What don't you understand about the comments in the first two
> screenfuls of Objects/setobject.c?
T
En Wed, 19 Mar 2008 20:53:49 -0300, dave berk <[EMAIL PROTECTED]>
escribió:
> I have an svg file i'm creating on the fly. How do I add the doctype and
> xml
> pi? They're not an element per se, and there is no function to add them.
The easiest way (but perhaps not-so-pure) is to just write th
Ok. After several tries, I think I found out why it breaks and it has
nothing to do with the number of records...
Here is the code/ see notes below:
# code starts here
# First import wincom32 client
from win32com.client import *
# Create the ADO Connection object via COM
On Mar 19, 3:36 pm, Wilbert Berendsen <[EMAIL PROTECTED]> wrote:
> Hi,
>
> i am writing a simple parser, that generates tokens. The parser needs to
> maintain some state, because some parts of the file consist of different
> tokens. I thought the object could simply remember its state by assigning
Oh right, why didn't I think of that. =)
Many thanks.
Timothy
On Thu, Mar 20, 2008 at 1:45 AM, Robert Bossy <[EMAIL PROTECTED]>
wrote:
> Timothy Wu wrote:
> > Hi,
> >
> > I am using xml.sax.handler.ContentHandler to parse some simple xml.
> >
> > I want to detect be able to parse the content
hi
i am trying to resize some images.First i'd read the size as a 2
tuple and then i want to divide it by 2 or 4 or 2.5 etc..
suppose
origsz=(400,300)
i want to divide the origsize by 2.5 so i can resize to (160,120)
scale=2.5
how can i get the newsz?
obviously origsz/2.5 won't work ..
thanks
R
Paul Rubin wrote:
> Jeff Schwab <[EMAIL PROTECTED]> writes:
>> ftping it as a flat file, and untarring it on the other side. Of
>> course, the motivation wasn't just to get the files from point A to
>> point B using Unix (which I already know how to do), but to take
>> advantage of an opportunity
101 - 163 of 163 matches
Mail list logo