I just assumed he had heard of me and knew better than to take my
advice. :-)
--
http://mail.python.org/mailman/listinfo/python-list
mjakowlew wrote:
> Steve,
>
> the os commands don't run through zope, it denies access to them to be
> run at all through the webserver. So in turn, I had to use a work
> around to fix the IE problem. Also qwwee's suggestion to use:
>
> filepath.split('\\')[-1]
>
> works well too. Zope is very
Steve,
the os commands don't run through zope, it denies access to them to be
run at all through the webserver. So in turn, I had to use a work
around to fix the IE problem. Also qwwee's suggestion to use:
filepath.split('\\')[-1]
works well too. Zope is very finicky about running specific com
mjakowlew wrote:
> I got the "IE Fix" working, here's the code:
>
>
> path = r'c:\here\there\files\file.ext'
>
> i=len(path)
> j=0
> size=len(path)
>
> while i:
> i=i-1
> if path[i]== '\\':
> j=i+1
> break
>
> filename = path[j:size]
> print "FILENAME:
I got the "IE Fix" working, here's the code:
path = r'c:\here\there\files\file.ext'
i=len(path)
j=0
size=len(path)
while i:
i=i-1
if path[i]== '\\':
j=i+1
break
filename = path[j:size]
print "FILENAME: %s" %(filename)
___
Mo
Hi mjakowlew,
to get file basename in Linux I use simply:
filepath.split('/')[-1]
But in Windows, being the dir separator '\',
you get into trouble if the dir or file name begins
with one of the "escape sequences":
\a ASCII Bell(BEL) \x07
\b ASCII Backspace (BS) \x08
\f
Thanks guys. The os.path method works, but this is for a script for a
website upload program on a zope webserver. For some reason even admin
access won't let me run the script through the server.
The main issue with my script is that Firefox has no problem with the
program the way it is, but IE so
"mjakowlew"wrote:
> filepath='c:\documents\web\zope\file.ext'
>
> I need to extract everthing after the last '\' and save it.
that string doesn't contain what you think it does:
>>> filepath='c:\documents\web\zope\file.ext'
>>> filepath
'c:\\documents\\web\\zope\x0cile.ext'
>>> print filepath
c:
import os
print os.path.basename(filepath)
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I'm trying to use some string manipulation from a file's path.
filepath='c:\documents\web\zope\file.ext'
I need to extract everthing after the last '\' and save it.
I've looked around and have tried the sub, search, match commands, but
I'm guessing '\' is set aside for switches. I need to kn
10 matches
Mail list logo