From bda1e2d7a18861036d74470672172c9a26cdba02 Mon Sep 17 00:00:00 2001 From: Max Schommer Date: Mon, 14 Mar 2016 02:42:29 -0400 Subject: [PATCH] Why --- Test.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ blah.txt | 2 ++ blah2.txt | 2 ++ counter.p | 2 ++ counter.py | 15 ++++++++++++++- lolcatz.db | Bin 0 -> 12288 bytes mytest.txt | 0 words.txt | 2 ++ 8 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 Test.py create mode 100644 blah.txt create mode 100644 blah2.txt create mode 100644 counter.p create mode 100644 lolcatz.db create mode 100644 mytest.txt create mode 100644 words.txt 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 0000000000000000000000000000000000000000..119189d5bec6197ac1c35f68e9a17fc77a3d510b GIT binary patch literal 12288 zcmeI%F$w}P5CFhELD51K!3SLDH^j!`z(x@)1Uo+?Sm_`9jsLK)we!Le@W9f-Vgj2D zyCH#THzJ~_Bdx=<7lU*d*U?Xhh)$DQ`(@UPZrwjGueZmfX{9&vJNfecbliWd=e|sU z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF{7xXv=s)NDop_F7_!`xFtDb)} m|IZRK0RjXF5FkK+009C72oU&BfnqUV?{;Nb7S*cSZq{!|suQyS literal 0 HcmV?d00001 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.