Skip to content

Instantly share code, notes, and snippets.

@bitoffdev
Created March 18, 2014 16:48
Show Gist options
  • Save bitoffdev/9624119 to your computer and use it in GitHub Desktop.
Save bitoffdev/9624119 to your computer and use it in GitHub Desktop.
def splice(l, index = 0, length = 1, *args):
temp = l[index:index + length-1]
del l[index:index + length-1]
for i in range(len(args)):
l.insert(index+i, args[i])
return temp
def fSelect():
'''Allows user to select file
and returns the full path'''
import os
path = "."
while True:
directory = os.listdir(path)
print "(0) .."
for i in range(len(directory)):
print "(%i)"%(i+1), directory[i]
change = int(raw_input('>>>'))
if change == 0:
path += "/.."
else:
path += "/" + directory[change-1]
if os.path.isfile(path):
return path
break
def printCell(string, width=40, height=5):
print("-" * (width+4))
for i in range(height):
line = "| "
for j in range(width):
pos = i*width + j
if pos<len(string):
line += string[pos]
else:
line += " "
line += " |"
print(line)
print("-" * (width+4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment