Good morning,
I am having a problem with file open, read & write. The example shows my
problem. I would have expected it to print a sequence 1,2,3,4 incrementing
every time it is run.
#!/usr/bin/env python
import os, shutil, time
basher_dir = '/home/dave/PodCasts'
bit_bucket = basher_dir + '
Dear Alan,
> I'm confused...
> #
> #This should be the complete file
> def OnMenuFindMe():
> print 'You found me'
> f = getattr(What_Should_It_Be???, 'OnMenuFindMe')
> f()
> #
> You are trying to get a reference to a function
in the same
> file and whose name y
Kent Johnson wrote:
> The first argument to __import__ should be a module or package name, not
> a file path, e.g. "my.settings". Python will look for the module in the
> current sys.path the same as if you used a normal import. Apparently the
> / is being interpreted as a . and I guess you have
Hi,
Given two strings I need to determine weather or not one of the strings is a subset of the other string. In at least one of the strings there is a star "*" which can be any character or a null there is a maximum of one star per string.
So basically I want the function to return true if you
Thanks for the help on the in operator, John. In answer to your question I did a little programming a long time ago in sequential languages such as dBase, FoxBase, Clipper, and a little C. Then Windows came along, my job changed, and I didn't really keep up in the event driven environment. I hav
My apologies to everyone. Here is the complete code:
class PriorityQueue:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def insert(self, item):
self.items.ap
Christopher Spears wrote:
> Here is a class called PriorityQueue:
>
> class PriorityQueue:
> def __init__(self):
> self.items = []
>
> def isEmpty(self):
> return self.items == []
>
> def insert(self, item):
>
On 27/07/06, Steve Haley <[EMAIL PROTECTED]> wrote:
> The error message is the same when I run the author's code but the error
> statement itself seems to indicate that there IS an in operator. I guess I
> really have a three questions. Is the in operator in version 2.1 of Python?
> If it is, wh
I am trying to make my way through a book on Python ("Python Ptogramming for the Absolute Beginner") and have run into some code in the book (and on the author's accompanying CD) that won't work. I suspect that it might be because my version of Python is too old (
2.1).
The code includes the in
Here is a class called PriorityQueue:
class PriorityQueue:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def insert(self, item):
self.items.append(item)
* Kent Johnson <[EMAIL PROTECTED]> [060726 17:49]:
> Tim Johnson wrote:
> > Hello:
> >
> > I'd like to set (write) and get (read) cookies on a client
> > computer via CGI.
> >
> > Does python have the libraries to do this. If so, pointers
> > to the libraries and documentation is welcomed.
>
> The
Tim Johnson wrote:
> Hello:
>
> I'd like to set (write) and get (read) cookies on a client
> computer via CGI.
>
> Does python have the libraries to do this. If so, pointers
> to the libraries and documentation is welcomed.
The Cookie module is to help with server-side cookies. Docs and examples
Hello:
I'd like to set (write) and get (read) cookies on a client
computer via CGI.
Does python have the libraries to do this. If so, pointers
to the libraries and documentation is welcomed.
thanks
tim
--
Tim Johnson <[EMAIL PROTECTED]>
http://www.alaska-internet-solutions.com
__
[EMAIL PROTECTED] wrote:
> Hi,
>
>
> My interpreter in set via sitecustomize.py to use utf-8 as default encoding.
>
> I'm reading fields from a dbf table to a firebird db with encoding set to
> win1252.
> I guess it's original encoding is cp850, but am not sure, and have been
> addressing excepti
> for key in sorted(result.keys): a sorted list of keys
Oops, that should of course be:
for key in sorted(result.keys() ):
Alan G.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi,
My interpreter in set via sitecustomize.py to use utf-8 as default encoding.
I'm reading fields from a dbf table to a firebird db with encoding set to
win1252.
I guess it's original encoding is cp850, but am not sure, and have been
addressing exceptions one by one with lines of:
r = r.rep
I have a script trying to use __import__ to read Python modules as config files
(among other things). Sounds simple enough.
To put it simply, full paths seem to fail but relative path work IF the script
is in that path too.
When I run it I get:
$ cd /tmp
$ ls
importer.py my
$ ls my
settings.py
Chris, You seem to be going through several hoops that
you don't need here. Let the data structures do the work
of storage and extract the data you want in its various
pieces. You are getting the entire data set in a string
then trying to pick out the bits you want, that defeats
the purpose of havi
Janos,
I'm confused...
#
#This should be the complete file
def OnMenuFindMe():
print 'You found me'
f = getattr(What_Should_It_Be???, 'OnMenuFindMe')
f()
#
You are trying to get a reference to a function in the same
file and whose name you know? So why not
I am attempting to use __import__() to read a Python file. It is not working.
What is particularly odd is that it works from the interactive prompt. Looking
at sys.path I can see that in the interactive session path starts with an empty
entry. Adding a similar entry to my script causes the impo
>> This works on a different principle than the linked list queue, but it
>> does the same stuff. The main idea is that a "queue" can be anything,
>> as long as it supports three operations:
>>
>> * isEmpty
>> * insert
>> * remove
>>
> <>
>
> Isn't there a fourth operation needed?
Tony Cappellini wrote:
> From: Kent Johnson <[EMAIL PROTECTED]>
>
>
>>> or you can import __main__, which is the top-level module
> Do you mean __main__ is the top level module for every python
> program/script?
>
Yes, at least in the standard Python runtime, I'm not sure what happens
when r
Chris Hallman wrote:
>
> I need some suggestions on how to work with a dictionary. I've got a
> program that builds a dictionary. I need to be able to manipulate the
> different keys and data so that I can write the output to a file AND
> utilize the smtplib to send the data in an email. I had p
Danny, et al:
> -Original Message-
> Date: Tue, 25 Jul 2006 15:43:34 -0700 (PDT)
> From: Danny Yoo <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] confused by linked queue
> To: Christopher Spears <[EMAIL PROTECTED]>
> Cc: Tutor
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: TEXT/PLAIN; ch
Title: Message
Chris,
This looks similar to what I do for my job. I
would be happy to help you, if I
can.
My first question is, how would you like the output
to look? Can you manually create a model of the email text you want to
send?
My second question is, can you create the
email
Chris Hallman wrote:
>
> I need some suggestions on how to work with a dictionary. I've got a
> program that builds a dictionary. I need to be able to manipulate the
> different keys and data so that I can write the output to a file AND
> utilize the smtplib to send the data in an email. I had p
Greetings:
> -Original Message-
> Date: Wed, 26 Jul 2006 10:11:28 +0100
> From: "Alan Gauld" <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] loops to assign variables
> To: tutor@python.org
> Message-ID: <[EMAIL PROTECTED]>
>
<>
>
> "John CORRY" <[EMAIL PROTECTED]> wrote
>
> > For example, I
I need some suggestions on how to work with a dictionary. I've got a program that builds a dictionary. I need to be able to manipulate the different keys and data so that I can write the output to a file AND utilize the smtplib to send the data in an email. I had problems using the data in the dict
Dear Kent,
>>You can look up the function in the globals()
dict, or you can import
>>__main__, which is the top-level module, and use getattr() on it.
Or you
>>could wrap your functions in a class...
>>
>>def OnMenuFindMe():
>> print 'You found me'
>>
>>f = globals()['OnMenuFindMe']
>>
>>f()
János Juhász wrote:
>
> Dear All,
>
> I want to use getattr() to collect a list with all the functions on my
> simple script those has got some functionname like 'On'.
>
> #This should be the complete file
> def OnMenuFindMe():
> print 'You found me'
>
> f = getattr(What_Should_It_Be???, '
Dear All,
I want to use getattr() to collect
a list with all the functions on my simple script those has got some functionname
like 'On'.
#This should be the complete file
def OnMenuFindMe():
print 'You found me'
f = getattr(What_Should_It_Be???, 'OnMenuFindMe')
f()
#Till here
It can
Sean Perry wrote:
> Ok, this may be slightly above tutor's level, but hey, never hurts to
> ask (-:
>
> I am playing with __import__(). Here is my code:
> [code]
> import os.path
>
> app_path = '/tmp/my/settings'
> app_path2 = 'my/settings'
>
> if os.path.exists(app_path + '.py'):
> print "F
"Nathan Pinno" <[EMAIL PROTECTED]> wrote:
> What's the invalid syntax?
Nathan, we have repeatedly asked you to post your
error messages, it really does help. We don't all have the time
nor inclination to have to read through every line of your code
trying to spot an error... Give us a clue, please
I'm reading the gmane news archive to see what I missed
while on vacation and noticed this. Sorry the response is
so late...
"John CORRY" <[EMAIL PROTECTED]> wrote
> For example, I have 30 textentry boxes numbered from entry20 to
> entry50.
> I have used the following code to assign the entrybox
34 matches
Mail list logo