18.188.40.207 |    

Navigation

Google Advertisement

Diese Funktion ist dazu gedacht, um den Dateinamen aus einen Unix/Windows Pfad zu extrahieren. Ist am Dateinamen, wie in einer Apache Logdatei ein Querystring dran, wird dieser abgeschnitten.

filename
  1. def filename( file ):
  2.     """filename -- extract the filename from file path
  3.  
  4.     (string) filename( (string) file )"""
  5.     from re import compile, findall
  6.     if file.find('?') == -1:
  7.         regexp = compile('([^\\\\/]+)$')
  8.     else:
  9.         regexp = compile('([^\\\\/]+)\\?')
  10.  
  11.     return regexp.findall(file)
Parsed in 0.002 seconds at 144.13 KB/s

Search
 
Full text search by name and content of a snippet.

User online
There are 2 users online.

Tags Cloud

Latest snippets
str2seconds
(Bash::Function)
is_integer
(Bash::Function)
file_rotate
(Bash::Function)
confirm
(Bash::Function)
is_workingtime
(Bash::Function)
last day of last month
(Bash::Snippets)
crypt_apr1_md5
(PHP::Function)
crypt_apr1_md5
(Perl::Function)
transparent
(CSS)
rfc2822Toiso8601
(PHP::Function)