On Thu, May 10, 2012 at 5:05 PM, Prasad, Ramit
wrote:
>> I have to process a csv file from a business partner. Oddly (?) they
>> don't quote text fields, and the Title field sometimes contains
>> commas. So I wrote some code to count the commas in each line and if
>> there were too many, I remov
> I have to process a csv file from a business partner. Oddly (?) they
> don't quote text fields, and the Title field sometimes contains
> commas. So I wrote some code to count the commas in each line and if
> there were too many, I removed the extras and wrote the cleaned up
> file to the origin
On 10/05/12 21:18, Dave Angel wrote:
out_file = open('revelex.csv', 'w')
# etc.
I would expect the open() to fail...
But he's opening it for WRITE, so it gets created just fine.
Ah yes, I didn't spot that. :-)
Too busy looking for a possible cause of a missing file message...
On Thu, May 10, 2012 at 4:18 PM, Dave Angel wrote:
> On 05/10/2012 12:56 PM, Alan Gauld wrote:
>> On 09/05/12 20:26, Joel Goldstick wrote:
>>> import os
>>> def pre_process():
>>> if os.path.isfile('revelex.csv'):
>>> os.rename('revelex.csv', 'revelex.tmp')
>>> print "Rename
On 05/10/2012 12:56 PM, Alan Gauld wrote:
> On 09/05/12 20:26, Joel Goldstick wrote:
>> import os
>> def pre_process():
>> if os.path.isfile('revelex.csv'):
>> os.rename('revelex.csv', 'revelex.tmp')
>> print "Renamed ok"
>> else:
>> print "Exiting, no revelex.c
On Wed, May 9, 2012 at 5:21 PM, Peter Otten <__pete...@web.de> wrote:
> Joel Goldstick wrote:
>
>> import os
>> def pre_process():
>> if os.path.isfile('revelex.csv'):
>> os.rename('revelex.csv', 'revelex.tmp')
>> print "Renamed ok"
>> else:
>> print "Exiting, no rev
On 09/05/12 20:26, Joel Goldstick wrote:
import os
def pre_process():
if os.path.isfile('revelex.csv'):
os.rename('revelex.csv', 'revelex.tmp')
print "Renamed ok"
else:
print "Exiting, no revelex.csv file available"
exit()
out_file = open('revele
Joel Goldstick wrote:
> import os
> def pre_process():
> if os.path.isfile('revelex.csv'):
> os.rename('revelex.csv', 'revelex.tmp')
> print "Renamed ok"
> else:
> print "Exiting, no revelex.csv file available"
> exit()
> out_file = open('revelex.csv', '
Hi,
On 9 May 2012 20:26, Joel Goldstick wrote:
> import os
> def pre_process():
>if os.path.isfile('revelex.csv'):
>os.rename('revelex.csv', 'revelex.tmp')
>print "Renamed ok"
>else:
>print "Exiting, no revelex.csv file available"
>exit()
>out_file = o
import os
def pre_process():
if os.path.isfile('revelex.csv'):
os.rename('revelex.csv', 'revelex.tmp')
print "Renamed ok"
else:
print "Exiting, no revelex.csv file available"
exit()
out_file = open('revelex.csv', 'w')
# etc.
if __name__ == '__main__'
John wrote:
> I noticed some odd behavior relating to eval(). First, a baseline case for
> behavior:
>
def test():
> ... x = 5
> ... return [a for a in range(10) if a == x]
> ...
test()
> [5]
>
> So far so good. Now let's try eval:
>
c = compile('[a for a in range(10) if a == x]'
I noticed some odd behavior relating to eval(). First, a baseline case for
behavior:
>>> def test():
... x = 5
... return [a for a in range(10) if a == x]
...
>>> test()
[5]
So far so good. Now let's try eval:
>>> c = compile('[a for a in range(10) if a == x]', '', 'single')
>>> eval(c, globals(
"Ben Ganzfried" wrote
x = input("First x is: ")
y = input("First y is: ")
input() reads strings
compare(x,y)
the character '1' is less than the character '5' so far as Python
is concerned
When I do simply compare(10, 5) from the shell,
You are using integers.
What happens if you u
Cast to an int:
x=int(x)
See if that helps.
On 1/7/11, Ben Ganzfried wrote:
> When I call one of my functions from the shell (ie compare(10, 5)) it
> produces the correct output. However, when I run the program after calling
> the method later in the script, the result is bizarre. I'm curious w
On Fri, Jan 7, 2011 at 11:38 AM, Ben Ganzfried wrote:
> When I call one of my functions from the shell (ie compare(10, 5)) it
> produces the correct output. However, when I run the program after calling
> the method later in the script, the result is bizarre. I'm curious why the
> wrong result i
When I call one of my functions from the shell (ie compare(10, 5)) it
produces the correct output. However, when I run the program after calling
the method later in the script, the result is bizarre. I'm curious why the
wrong result is printed. Here is an example:
def compare(x,y):
if x < y
phone: 317.242.2569
fax: 317.242.3469
e-mail: [EMAIL PROTECTED]
"elis aeris" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
07/20/2007 02:36 AM
To
"Luke Paireepinart" <[EMAIL PROTECTED]>
cc
python tutor
Subject
[Tutor] odd bug
I ran the code attache
I ran the code attached at the end of the email, it' supposed to out put a
string of characters,
yet I got only this
###
2.4.3.3.8.5.
definition check:
3
###
now, it's proper output, however, this part got run only once, when it's
supposed to run multiple times to produce more portio
from Guido's tutorial:
The given end point is never part of the generated list; range(10) generates
a list of 10 values, the legal indices for items of a sequence of length 10.
It is possible to let the range start at another number, or to specify a
different increment (even negative; sometimes t
* elis aeris <[EMAIL PROTECTED]> [2007-07-19 08:51]:
> I ran this
>
>
> for x in range(5,10):
>print x
>
> and OP was
>
> 5
> 6
> 7
> 8
> 9
>
> why is that? shouldn't it print
>
> 5
> 6
> 7
> 8
> 9
> 10?
That is the expected behaviour, per the documentation:
http://docs.python.org/lib/bu
> for x in range(5,10):
> print x
>
> and OP was
>
> 5
> 6
> 7
> 8
> 9
>
> why is that? shouldn't it print
>
> t
> 6
> 7
> 8
> 9
> 10?
no. the (well, one) syntax for range() is (start, stop) where it
counts starting from 'start' up to but not including 'stop'. if
you're familiar with C/C++
I ran this
for x in range(5,10):
print x
and OP was
5
6
7
8
9
why is that? shouldn't it print
t
6
7
8
9
10?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi Everyone,
Attached are three scripts that I intend to use for transporting a file
via IBM's WebSphere MQSeries middle-ware.
The sender script uses a regular expression to replace characters not
[a-z][A-Z][0-9] or white space with their hex value equivalents.
The purpose of this is to make the
(Oops, forgot to change this to go to the list...)
On 4/14/05, Orri Ganel <[EMAIL PROTECTED]> wrote:
> On 4/14/05, Rich Krauter <[EMAIL PROTECTED]> wrote:
>
> On 4/14/05, Max Noel <[EMAIL PROTECTED]> wrote:
> >Well, if you want b and a to refer to the same object, just use b =
> > a.
>
>
On 4/14/05, Rich Krauter <[EMAIL PROTECTED]> wrote:
> Maybe you could use a factory. It would allow you to simplify your Node
> class, and encapsulate the instantiation behavior you want outside the
> class.
Thanks for the suggestion; I think that's what I'll do.
On 4/14/05, Max Noel <[EMAIL PRO
Orri Ganel wrote:
Hello all,
As part of a project i'm doing (mostly for the fun of it), I have a
class which creates a sort of wrapper around any object to make it
suitable for use in a custom container. However, if the class
receives an already wrapped object, I want it to just return the
object
On Apr 14, 2005, at 12:58, Orri Ganel wrote:
a = Node(1)
b = Node(a)
12932600 12932600
1
id(b)
12960632
Any ideas on why this happens, or suggestions as to how to implement
the behavior I'm looking for (in which b and a would refer to the same
object, have the same id, etc.), would be greatly appre
Hello all,
As part of a project i'm doing (mostly for the fun of it), I have a
class which creates a sort of wrapper around any object to make it
suitable for use in a custom container. However, if the class
receives an already wrapped object, I want it to just return the
object (same id and ever
Robert, Andrew wrote:
Hi Everyone,
I am trying to do an MQ inquiry but I am having mixed results.
If I do the command direct via a print statement like the one below, it
works,
print 'Queue Description:\t' , q.inquire(CMQC.MQCA_Q_DESC)
When I try to cycle through an array of command line supplied k
Hi Everyone,
I am trying to do an MQ inquiry but I am having mixed results.
If I do the command direct via a print statement like the one below, it
works,
print 'Queue Description:\t' , q.inquire(CMQC.MQCA_Q_DESC)
When I try to cycle through an array of command line supplied keys, it
fails.
30 matches
Mail list logo