Skip to content

Instantly share code, notes, and snippets.

View c0x6a's full-sized avatar
👽
None != ''

Carlos Joel c0x6a

👽
None != ''
View GitHub Profile
@c0x6a
c0x6a / filename.py
Created August 1, 2014 16:22
Get filename and extension from a /path/to/foofile.bar
# 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')
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal

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: