Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python2
# description: generate a series of arithmetic for teaching
# TODO
import os
import sys
import random
import string
def generater(rang):
@longarm
longarm / changedir.py
Last active December 15, 2015 23:00
In Perforce, user will have a request to jump between center and local client by soft link .s for example local client directory: /a/b/c/d/e/f ; center directory /a/b/c/.s/d/e/f
import os
currentPath=os.getcwd()
tail=''
while currentPath != '/':
aa=os.path.split(currentPath)
tail=os.path.join(aa[1], tail)
if os.path.lexists(os.path.join(aa[0],'.s')):
os.chdir(os.path.join(aa[0], '.s', tail))
break