![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 | |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
Quote:
|
|
|
|
|
|
|
#12 | |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
ColdDeath, you got my adminpass! GAHHHH! @_@
Oh nevermind, you can have it: Quote:
![]() |
|
|
|
|
|
|
#13 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Oh, and by the way. All I did was make it look for '..' in the filename. Tell me if there's any way around this, or any exploits. Maybe like using %2E for a period or something.
I don't want to make the switch to os.path.basename yet. But from the sounds of it, is that just a variation of os.getcwd()? |
|
|
|
|
|
#14 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4
![]() |
Quote:
os.path.basename("somedirectory/../whatever/./filename.ext") -> "filename.ext" |
|
|
|
|
|
|
#15 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
|
|
|
|
|
|
#16 |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
Because that's os specific - the os.path related functions work whether you're working with paths on Mac, Win, whatever. And why are you doing chr(92) instead of '\\'?
*scratches head* |
|
|
|
|
|
#17 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
I've found chr(92) is more stable/consistent inside a literal and it makes it easier to search + replace (searching for \\ does some weird stuff if I recall correctly).
|
|
|
|
|
|
#18 |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
By searching you mean something like "foo\\bar".find("\\")?
|
|
|
|
|
|
#19 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 4
![]() |
Quote:
If I have a choice between using a tried-and-tested function or writing it myself, I'd personally go with the tried-and-tested method, as there's less likelyhood of there being a mistake in the code. |
|
|
|
|
|
|
#20 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Ooh, that's weird when I tried it, it only works when you print the output. Not when you just let the shell return it.
That's weird. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|