2
0
mirror of https://github.com/narkoz/hacker-scripts synced 2025-08-23 10:57:13 +00:00

Merge pull request #41 from WKPlus/master

use with instead of file open and close
This commit is contained in:
Nihad Abbasov 2015-11-26 10:39:09 +04:00
commit 47e8900c37
2 changed files with 2 additions and 28 deletions

View File

@ -41,17 +41,4 @@ client.messages.create(
body="Gonna work from home. " + random.choice(excuses) body="Gonna work from home. " + random.choice(excuses)
) )
try: print "Message sent at " + strftime("%a, %d %b %Y %H:%M:%S")
f = open('logs/file.txt', 'a')
except IOError as e:
# dir & file don't exist; create them
os.mkdir('logs')
f = open('logs/file.txt', 'a')
except Exception as e:
print e
else:
pass
# log it
f.write("Message sent at " + strftime("%a, %d %b %Y %H:%M:%S") + "\n")
f.close()

View File

@ -42,17 +42,4 @@ client.messages.create(
body="Late at work. " + random.choice(reasons) body="Late at work. " + random.choice(reasons)
) )
try: print "Message sent at " + strftime("%a, %d %b %Y %H:%M:%S")
f = open('logs/file.txt', 'a')
except IOError as e:
# dir & file don't exist; create them
os.mkdir('logs')
f = open('logs/file.txt', 'a')
except Exception as e:
print e
else:
pass
# log it
f.write("Message sent at " + strftime("%a, %d %b %Y %H:%M:%S") + "\n")
f.close()