tting the string on "." and using rfind to find the last
instance of "_".
i.e.,
myStr = "wisconsin_state.txt"
pieces = myStr.split(".")
substr = pieces[0][pieces[0].rfind("_") + 1:]
--hiaips
--
http://mail.python.org/mailman/listinfo/python-list
Kevin Walzer wrote:
> hiaips wrote:
> > [EMAIL PROTECTED] wrote:
> >> Earlier I asked about how people installed Python on OS X, given that
> >> one can choose from Xcode, Fink, Darwin, ActiveState and source builds:
> >>
> >> http://groups.google.co
[EMAIL PROTECTED] wrote:
> Earlier I asked about how people installed Python on OS X, given that
> one can choose from Xcode, Fink, Darwin, ActiveState and source builds:
>
> http://groups.google.com/group/comp.lang.python/browse_thread/thread/5c4cde4206d1fbb7/37de06a6bb6b2361?lnk=gst&q=OS+X+and+P
ishtar2020 wrote:
> Hi everyone
>
> I'm sure this question is kinda stupid and has been answered a few
> times before... but I need your help!
>
> I'm writing a small application where the user can analyze some text
> based on a set of changing conditions , and right now I'm stuck on a
> point wh
asincero wrote:
> Would it be considered good form to begin every method or function with
> a bunch of asserts checking to see if the parameters are of the correct
> type (in addition to seeing if they meet other kinds of precondition
> constraints)? Like:
>
> def foo(a, b, c, d):
>as
metaperl wrote:
> I'm about to get a new OS X box on which I will rewrite a bunch of data
> munging scripts from Perl to Python. I know that there are several port
> services for OS X (fink, darwin ports, opendarwin). So I am not sure
> whether to use their port of Python or whether to build from
> Java itself never deserved to be the 'next' anything anyway. It was
> sold on hype and has never lived up to it. I can see your point from a
> business perspective but I like to think Python is sold on its merits
> and not on being the new panacea for middle managers to deploy.
Bravo. I could
KraftDiner wrote:
> I have a dictionary and sometime the lookup fails...
> it seems to raise an exception when this happens.
> What should I do to fix/catch this problem?
>
> desc = self.numericDict[k][2]
> KeyError: 589824 < This is the error that is being produced,
> because there is n
Tom Strickland wrote:
> Hopefully this is a simple question. I've started to program in Python
> after an absence of about a year, so I'm very rusty. I wrote a short
> program and tried to run it using Python2.4 in Linux. I keep getting
> "permission denied" messages after entering the path to the
What I'm getting at is that it looks like one of these arch flags needs
to be removed, as a previous poster said. I remember having a similar
issue with an arch flag when installing some Python module (don't
remember whether it was MySQLdb or not), and I fixed it by installing
the Universal SDK th
T wrote:
> I connect to a FTP server which can be either unix or windows server.
> Once in the FTP session, I would like to delete a directory tree on the
> server. Is there a command that will do this? If not, can someone
> point me to a right direction?
>
> Thanks!
Oops...just noticed that yo
T wrote:
> I connect to a FTP server which can be either unix or windows server.
> Once in the FTP session, I would like to delete a directory tree on the
> server. Is there a command that will do this? If not, can someone
> point me to a right direction?
>
> Thanks!
Try using an "FTP" object f
Yi Xing wrote:
> Hi,
>
> I met the following error when I tried to install MySQLdb. I had no
> problem installing numarray, Numeric, Rpy, etc. Does anyone know
> what's the problem? Thanks!
>
> running install
> running build
> running build_py
> creating build
> creating build/lib.darwin-7.9.0-P
M_M wrote:
> Michiel Sikma wrote:
> > Introducing 13 year olds to a programming language? You're gonna have a
> > hard time finding good literature for that. Even if you do, it's going
> > to cost a lot of time to guide them.
> >
> > "Beginning Python: From Novice to Professional" by Magnus Lee He
I'm assuming that FOS = "free open source"...
In any case, what operating system do you run? If you're on OS X, I
highly recommend TextMate. It's not free, but it has good support
(either via built-in or third-party plugins) for Python as well as
HTML, SQL, XML, Django templates, and the like. A
Oops, what I wrote above isn't quite correct. As another poster pointed
out, you'd want to do
for file in x[2]:
...
--dave
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Thanks, Dave. That's exactly what I was looking for, well, except for
> a few small alterations I'll make to achieve the desired effect. I
> must ask, in the interest of learning, what is
>
> [file for file in files if file.endswith(extension)]
>
> actually doing? I k
> I'm thinking os.walk() could definitely be a big part of my solution,
> but I need a little for info. If I'm reading this correctly, os.walk()
> just goes file by file and serves it up for your script to decide what
> to do with each one. Is that right? So, for each file it found, I'd
> have
> [EMAIL PROTECTED] wrote:
> > I'm new at Python and I need a little advice. Part of the script I'm
> > trying to write needs to be aware of all the files of a certain
> > extension in the script's path and all sub-directories. Can someone
> > set me on the right path to what modules and calls t
I also recommend psycopg.
--Dave
--
http://mail.python.org/mailman/listinfo/python-list
Christoph,
Well, if you format the data as a Python dictionary and give the data
file a .py extension, it becomes a Python module that you can load and
reload dynamically. That's sort of what I was thinking.
--Dave
--
http://mail.python.org/mailman/listinfo/python-list
y about parsing it.)
I don't know whether any of this makes sense for your problem, but in
any case, good luck.
--hiaips
--
http://mail.python.org/mailman/listinfo/python-list
Another option would be to use the psycopg module to connect to
postgres from within your Python code. See
http://www.initd.org/projects/psycopg1 for more information.
--hiaips
--
http://mail.python.org/mailman/listinfo/python-list
well
> addressed. =)
>
> thanks. have a nice one.
Hi, damacy,
Maybe I'm not understanding your code 100%, but have you tried catching
the return value of the psql process that you're launching? Just a
thought...
--hiaips
--
http://mail.python.org/mailman/listinfo/python-list
steve wrote:
> I mean Aspect-Oriented Programming.
> If any please give me some of links.
> Thanks a lot.
See http://en.wikipedia.org/wiki/Aspect-oriented_programming.
There is a list of AOP implementations for a number of languages
(including Python) near the bottom of the page.
25 matches
Mail list logo