"chinni" <[EMAIL PROTECTED]> wrote
> I am working on MAC and my App was based on Xml file.If any updates
> r any
> changes in the xml file my app will load that changes.
> as i am new to python.i want to automate that one.
> details snipped
> Here the size is in KB's.Now plz tell me how to
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote
>sorry, forgot a piece of the code :
>
>s = list(s)
>while s[0].isspace() :
> while s[-1].isspace() :
> del s[-1]
> del s[0]
> s = ''.join(s)
It still won't work. Strings are immutable, you can't use del
to delete a character. Try it.
>>
never mind found my answer here
http://docs.python.org/lib/os-file-dir.html
On 10/2/07, Kamal <[EMAIL PROTECTED]> wrote:
>
> would appreciate any pointers.
>
> --
> Thanks,
> Kamal
--
Thanks,
Kamal
___
Tutor maillist - Tutor@python.org
http://ma
would appreciate any pointers.
--
Thanks,
Kamal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi,
I am working on MAC and my App was based on Xml file.If any updates r any
changes in the xml file my app will load that changes.
as i am new to python.i want to automate that one.
there will be one URL and size will mention in that Xml file.i want to write
a script so that it will download the
cuongvt wrote:
> Hello
> I'm new to both Django and Python. I'm mainly developing on PHP.
> I tend to move to Django. But I want to confirm as below:
> I heard that Django is mainly used for something like content management,
> CMS or something
> like that and Rails is mainly for web applicatio
Hello
I'm new to both Django and Python. I'm mainly developing on PHP.
I tend to move to Django. But I want to confirm as below:
I heard that Django is mainly used for something like content management,
CMS or something
like that and Rails is mainly for web applications.
So my question: is it
Alan Gauld wrote:
> "Ricardo Aráoz" <[EMAIL PROTECTED]> wrote
>
>> So as not to copy strings many times :
>>
>> while s[0].isspace() :
>>while s[-1].isspace() :
>>del s[-1]
>>del s[0]
>
> Sorry, it won;t work. Strings are immutable.
> However you can keep a track of the indexes of
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote
>
> So as not to copy strings many times :
>
> while s[0].isspace() :
>while s[-1].isspace() :
>del s[-1]
>del s[0]
Sorry, it won;t work. Strings are immutable.
However you can keep a track of the indexes of the
first and last non space c
Andrew James wrote:
> *headbang*
>
> I'm an idiot. s=s[:-2] should be s=s[:-1].
>
> Andrew James wrote:
>> And as soon as I send it again I realise a pretty stupid error. The
>> two loops shouldn't be nested.
>>
>> Andrew James wrote:
>>> Helps if I send it to the group...
>>>
>>> And Kent, I di
John Fouhy wrote:
> On 02/10/2007, GTXY20 <[EMAIL PROTECTED]> wrote:
>> Hello all,
>>
>> Let's say I have the following dictionary:
>>
>> {1:(a,b,c), 2:(a,c), 3:(b,c), 4:(a,d)}
>>
>> I also have another dictionary for new value association:
>>
>> {a:1, b:2, c:3}
>>
>> How should I approach if I wan
Ian, thanks for cleaning this up and submitting it. I was curious what
its performance would be.
On Wed, 26 Sep 2007, Ian Witham wrote:
> while count > 0:
> fivecount += count
> count /= 5
This is a great improvement, and I'm embarrased that I didn't think of it
myself!
GTXY20 wrote:
>
> I have the transFn function as follows:
>
> def transFn(translatefile):
> transfile = open(translatefile, 'r')
> records = transfile.read()
> transfile.close()
> lines = records.split()
> transDict = {}
> for line in lines:
> key, value = line.spl
I have the transFn function as follows:
def transFn(translatefile):
transfile = open(translatefile, 'r')
records = transfile.read()
transfile.close()
lines = records.split()
transDict = {}
for line in lines:
key, value = line.split(',')
transDict[key] = valu
bhaaluu wrote:
> On 10/2/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>> traceback.print_stack() prints the stack trace to the current point of
>> execution. No forced error or drama needed :-)
>>
>> Kent
>
> Exactly how is this used, please?
>
> Traceback (most recent call last):
> File "print_
Dave Kuhlman wrote:
> Question: Someday will all the Python built-ins be implemented in
> Cython/Pyrex.
I would bet on RPython against Pyrex:
http://codespeak.net/pypy/dist/pypy/doc/extcompiler.html
Kent
___
Tutor maillist - Tutor@python.org
http://ma
GTXY20 wrote:
> Here's an interesting question:
>
> Can I use the transFn function to remove items in the value list.
>
> Can this be done by simple assigning the current value a value of null
> in the translate file?
No, that will make the translated value be None (I guess that is what
you mea
Here's an interesting question:
Can I use the transFn function to remove items in the value list.
Can this be done by simple assigning the current value a value of null
in the translate file?
M.
On 10/2/07, GTXY20 <[EMAIL PROTECTED]> wrote:
> I adjusted so that I get the following so if I do
On Tue, Oct 02, 2007 at 06:48:13AM -0400, Kent Johnson wrote:
> Christopher Spears wrote:
> > I was looking for the source code for the strip
> > functions at python.org. I didn't find anything. Do
> > you or someone else know where the source code is
> > posted? I tried to find python on my wor
I adjusted so that I get the following so if I do not need to translate a
dictionary I do not call the function transFn:
def transFn(translatefile):
transfile = open(translatefile, 'r')
records = transfile.read()
transfile.close()
lines = records.split()
transDict = {}
for
bhaaluu wrote:
> On 10/2/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>> traceback.print_stack() prints the stack trace to the current point of
>> execution. No forced error or drama needed :-)
>>
>> Kent
>
> Exactly how is this used, please?
>
> Traceback (most recent call last):
> File "print_
On 10/2/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> traceback.print_stack() prints the stack trace to the current point of
> execution. No forced error or drama needed :-)
>
> Kent
Exactly how is this used, please?
Traceback (most recent call last):
File "print_stack.py", line 160, in ?
Suzanne Peel wrote:
>
> Thankyou for your help,
>
> However both suggestions will only give me that name of the 1st file
> executed eg when I use *execfile('EA_Owner.py')* the name returned
> when the __file__ or sys.argv[0] is executed always EA_Owner.py .
>
> The Traceback feature is an ex
GTXY20 wrote:
>
> This seemed to work:
>
> def transFn(c):
> transfile = open('translate.txt', 'r')
> records = transfile.read()
> transfile.close()
> lines = records.split()
> transDict = {}
> for line in lines:
> key, value = line.split(',')
> transDict[k
John Fouhy wrote:
> You could use the map function...
>
> Let's say we have something like:
>
> transDict = { 'a':1, 'b':2, 'c':3 }
>
> We could define a function that mirrors this:
>
> def transFn(c):
> try:
> return transDict[c]
> except KeyError:
> return c
This coul
Andrew James wrote:
> Helps if I send it to the group...
>
> And Kent, I didn't post it originally because I figured the other guy
> was still working on his script. Besides, I didn't think it'd be that
> far fetched for you to assume I was using something like "while s[0] ==
> ' ':"
Actually
Christopher Spears wrote:
> I was looking for the source code for the strip
> functions at python.org. I didn't find anything. Do
> you or someone else know where the source code is
> posted? I tried to find python on my workstation, but
> I'm not sure where the sys admin installed it.
The sour
"GTXY20" <[EMAIL PROTECTED]> wrote
> Let's say I have the following dictionary:
>
> {1:(a,b,c), 2:(a,c), 3:(b,c), 4:(a,d)}
>
> I also have another dictionary for new value association:
>
> {a:1, b:2, c:3}
I assume the keys should be strings: 'a','b','c'?
Not the variable names a,b,c?
> How shou
Alan Gauld wrote:
> "Suzanne Peel" <[EMAIL PROTECTED]> wrote
>
>
>> However both suggestions will only give me that name of the 1st file
>> executed eg when I use execfile('EA_Owner.py') the name returned
>> when
>> the __file__ or sys.argv[0] is executed always EA_Owner.py .
>>
>
> You
This seemed to work:
def transFn(c):
transfile = open('translate.txt', 'r')
records = transfile.read()
transfile.close()
lines = records.split()
transDict = {}
for line in lines:
key, value = line.split(',')
transDict[key] = value
try:
return tran
"Suzanne Peel" <[EMAIL PROTECTED]> wrote
> However both suggestions will only give me that name of the 1st file
> executed eg when I use execfile('EA_Owner.py') the name returned
> when
> the __file__ or sys.argv[0] is executed always EA_Owner.py .
You didn't mention you were doing wacky stuf
"Christopher Spears" <[EMAIL PROTECTED]> wrote
>I was looking for the source code for the strip
> functions at python.org. I didn't find anything. Do
> you or someone else know where the source code is
> posted? I tried to find python on my workstation, but
> I'm not sure where the sys admin i
"Andrew James" <[EMAIL PROTECTED]> wrote
> *headbang*
>
> I'm an idiot. s=s[:-2] should be s=s[:-1].
>
> Andrew James wrote:
>> And as soon as I send it again I realise a pretty stupid error. The
>> two loops shouldn't be nested.
>>
>> Andrew James wrote:
>>> Helps if I send it to the group...
S
Sorry - solved my own problem - it was the way I was creating my dictionary
and assigning the value as a list.
I will post my final working code shortly.
M.
On 10/2/07, GTXY20 <[EMAIL PROTECTED]> wrote:
>
> I seem to be encountering a problem and I think it is because I actually
> have my data a
I seem to be encountering a problem and I think it is because I actually
have my data as follows:
data = {1:[a,b,c], 2:[a,c], 3:[b,c], 4:[a,d]}
not as previously mentioned:
data = {1:(a,b,c), 2:(a,c), 3:(b,c), 4:(a,d)}
So the values are actually stored as a list.
I am trying to adjust so that
*headbang*
I'm an idiot. s=s[:-2] should be s=s[:-1].
Andrew James wrote:
> And as soon as I send it again I realise a pretty stupid error. The
> two loops shouldn't be nested.
>
> Andrew James wrote:
>> Helps if I send it to the group...
>>
>> And Kent, I didn't post it originally because I fig
And as soon as I send it again I realise a pretty stupid error. The two
loops shouldn't be nested.
Andrew James wrote:
> Helps if I send it to the group...
>
> And Kent, I didn't post it originally because I figured the other guy
> was still working on his script. Besides, I didn't think it'd be
Helps if I send it to the group...
And Kent, I didn't post it originally because I figured the other guy
was still working on his script. Besides, I didn't think it'd be that
far fetched for you to assume I was using something like "while s[0] ==
' ':"
Andrew James wrote:
> I'm always nervous
38 matches
Mail list logo