Skip to main content

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


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 details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

get_filename-1.0.0-py3.8.egg (3.6 kB view details)

Uploaded Egg

get_filename-1.0.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file get_filename-1.0.0.tar.gz.

File metadata

  • Download URL: get_filename-1.0.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for get_filename-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7cbfd90dd4a6a84bddb04b8924eebec8e218bc9578152e27589ab5814b13d208
MD5 6b152f429ec5b464cf41eeba2a70256c
BLAKE2b-256 b20a3d8c177463b9a646ee40903138230bf2f04322123bf3cc8cee8c71025287

See more details on using hashes here.

File details

Details for the file get_filename-1.0.0-py3.8.egg.

File metadata

  • Download URL: get_filename-1.0.0-py3.8.egg
  • Upload date:
  • Size: 3.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for get_filename-1.0.0-py3.8.egg
Algorithm Hash digest
SHA256 c3f734211638519504af390c94d4333d41a7754950d80f81c4e601cb8104d3a7
MD5 fc2a3b1fc395635d862b25198793dabb
BLAKE2b-256 74abe8de553e9de9d68fb1bb356b623e7ae439499980b1d4a2907d8fa5f1f54f

See more details on using hashes here.

File details

Details for the file get_filename-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: get_filename-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for get_filename-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 acaf7e7d19d84de5aed8c3a98e86ea151dc319086aeb8608af93b79cf90946ec
MD5 512818d5dd64e37fb2edace3fc5a1a57
BLAKE2b-256 736f6a97183aca9fd5075f1d63b52b52b8fa5d526104f3a482f2a81bb31888ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page