Skip to content

Instantly share code, notes, and snippets.

Avatar
👽
None != ''

Carlos Joel c0x6a

👽
None != ''
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am c0x6a on github.
  • I am c0x6a (https://keybase.io/c0x6a) on keybase.
  • I have a public key ASCgY80mWIj4SvheSmUOqj1jklhg31uw2UFIglOTYpnvjQo

To claim this, I am signing this object:

@c0x6a
c0x6a / filename.py
Created Aug 1, 2014
Get filename and extension from a /path/to/foofile.bar
View filename.py
# coding=utf-8
def file_name_ext(path_to_file, with_dots=True):
"""
Returns file_name and file_extension from a given path; if the file
has dots in its name and `with_dots` is False, they will be removed.
Example:
/some/long/path/to/file.txt will return ('file', 'txt')
/some/long/path/to/file.with.dots.txt will return ('filewithdots', 'txt')
View Evolution of a Python programmer.py
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
You can’t perform that action at this time.