from a filename(str) extension or name
Project description
get_filename
我絕對不要再為了這個坑花了整整2小時 Orz......
如題,只是一個獲取檔案名稱或副檔名的東東。
From a filename(str) get extension or name.
用法 how to use
get_filename( filename=str, mode='filename', index=0):
@param {str} filename (不能為空)
@param {str} mode ('filename' or 'extension') or ( 1 or 2)
@param {int} index (當 mode = 'extension' 或 2 才會作用)
@return {str}
ex1 :
t = get_filename('explosion.hard.txt')
t -> 'explosion.hard'
ex2 :
t = get_filename('/path/to/somefile.ext')
t = 'somefile'
ex3 :
t = get_filename('explosion.hard.txt','extension',-3)
t = get_filename('explosion.hard.txt',2,0)
t -> 'explosion'
ex4 :
t = get_filename('/path/to/somefile.txt','extension',-1)
t = get_filename('/path/to/somefile.txt',2,-1)
t -> 'txt'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
get_filename-1.0.0.tar.gz
(2.2 kB
view hashes)
Built Distributions
get_filename-1.0.0-py3.8.egg
(3.6 kB
view hashes)
Close
Hashes for get_filename-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acaf7e7d19d84de5aed8c3a98e86ea151dc319086aeb8608af93b79cf90946ec |
|
MD5 | 512818d5dd64e37fb2edace3fc5a1a57 |
|
BLAKE2b-256 | 736f6a97183aca9fd5075f1d63b52b52b8fa5d526104f3a482f2a81bb31888ad |