Skip to content

Commit

Permalink
add string ops
Browse files Browse the repository at this point in the history
  • Loading branch information
bambreeze committed Nov 19, 2015
1 parent 0a69478 commit 663f946
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/encrypt.py
@@ -1,6 +1,6 @@
#!/usr/bin/python

import os, sys, string
import os, sys, string, time

def encrypt_xor2(data, key):
buff = ""
Expand All @@ -12,6 +12,7 @@ def encrypt_xor2(data, key):
pw = sys.argv[2]
fname2 = sys.argv[1] + '.cpt'

print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
infile = open(fname, "rb")
outfile = open(fname2, "wb")

Expand All @@ -21,10 +22,10 @@ def encrypt_xor2(data, key):
break;

line2 = encrypt_xor2(line, pw)
#print line2
outfile.write(line2)

infile.close()
outfile.close()

#os.remove(fname)
print time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
20 changes: 20 additions & 0 deletions python/strops.py
@@ -0,0 +1,20 @@
#!/usr/bin/python

import os, sys, string, time

mystr1 = 'abc'
mystr2 = 'abc.def'
mystr3 = 'abc.def.ghi'

if mystr1.find('.'):
print "not find ."

idx = mystr2.index('.')
print idx

idx = mystr3.index('.')
print idx

sStr1 = 'abcdefg'
sStr1 = sStr1[::-1]
print sStr1

0 comments on commit 663f946

Please sign in to comment.