diff --git a/Test.py b/Test.py new file mode 100644 index 0000000..e7750e1 --- /dev/null +++ b/Test.py @@ -0,0 +1,50 @@ +import os +import anydbm +import pickle + + +t = [1,2,3] +s = pickle.dumps(t) +t2 = pickle.loads(s) +from pattern.web import * + +f = Facebook(licence='CAAEuAis8fUgBAJQKS4ZBRUsxIRlsrW76PcYITJRC5hAoFmhYCyZBWDQc7NLFHtRABcRemTZA6YWByo12xL6ZB8gttBA4lDABIQI8fIcq9Eroaq2VRPoW8ZAPzarU1y7ZBL34eeYYO9TRNcpnMJsVrCN2gZAJICRcnCM5YsDZCXTANkNJSxD0sJw3kuoTGmYourEZD') +me = f.profile() +print me +print t2 +print t2 == t +print t2 is t +# cmd = 'python Test.py' +# fp = os.popen(cmd) +# res = fp.read() +print res +# db = anydbm.open('lolcatz.db', 'c') + +# db['LOLWUT'] = 'CATZZ!!!' +# print db['LOLWUT'] +# db.close +# def test(): +# # mystring = raw_input("Hi") +# # ("Input the letters you want to avoid: ") +# fin = open('words.txt' , 'w') +# line1 = "This here's the wattle, \n" +# fin.write(line1) +# line2 = "the emblem of our land.\n" +# camels = 42 +# print 'I have spotted %d camels.' % camels +# fin.write(line2) +# fin.close() +# test() + + +# def walk(dirname): +# for name in os.listdir(dirname): +# path = os.path.join(dirname, name) + +# if os.path.isfile(path): +# print path +# else: +# walk(path) + + +# walk('/home') diff --git a/blah.txt b/blah.txt new file mode 100644 index 0000000..ba8c4c4 --- /dev/null +++ b/blah.txt @@ -0,0 +1,2 @@ +I3 +. \ No newline at end of file diff --git a/blah2.txt b/blah2.txt new file mode 100644 index 0000000..1cc9408 --- /dev/null +++ b/blah2.txt @@ -0,0 +1,2 @@ +I2 +. \ No newline at end of file diff --git a/counter.p b/counter.p new file mode 100644 index 0000000..569369f --- /dev/null +++ b/counter.p @@ -0,0 +1,2 @@ +I1 +. \ No newline at end of file diff --git a/counter.py b/counter.py index 1e2fb56..941c991 100644 --- a/counter.py +++ b/counter.py @@ -29,7 +29,20 @@ def update_counter(file_name, reset=False): >>> update_counter('blah2.txt') 2 """ - pass + if exists(file_name): + mycounter = load(open(file_name,"rb")) + mycounter += 1 + if reset == True: + mycounter = 1 + print mycounter + dump( mycounter, open(file_name, "wb")) + else: + mycounter = 1 + print mycounter + dump(mycounter, open(file_name, "wb")) + + +update_counter("blah.txt") if __name__ == '__main__': if len(sys.argv) < 2: diff --git a/lolcatz.db b/lolcatz.db new file mode 100644 index 0000000..119189d Binary files /dev/null and b/lolcatz.db differ diff --git a/mytest.txt b/mytest.txt new file mode 100644 index 0000000..e69de29 diff --git a/words.txt b/words.txt new file mode 100644 index 0000000..66ebffc --- /dev/null +++ b/words.txt @@ -0,0 +1,2 @@ +This here's the wattle, +the emblem of our land.