In [35]:
import socket
hosName = (socket.gethostname())

In [36]:
print hosName


whitu

In [37]:
import time

In [38]:
time.strftime("%D,%H:%M")


Out[38]:
'01/23/14,15:07'

In [39]:
print time.strftime("%c")


Thu Jan 23 15:07:33 2014

In [40]:
import os

In [41]:
os.getuid()


Out[41]:
1002

In [48]:
import getpass

In [49]:
userName = getpass.getuser()

In [50]:
print userName


william

In [51]:
import random

In [52]:
pauseScript = random.randint(0,10)

In [53]:
time.sleep(pauseScript)

In [46]:
for user in userName:
    user == ('public'), user ==('public' + hosName)

In [47]:
print user


m

In [56]:
[('hello': '30')]


  File "<ipython-input-56-987f7b1bf83f>", line 1
    [('hello': '30')]
             ^
SyntaxError: invalid syntax

In [92]:
users = dict(hunnyb=300, zcat=300, destiny=300)

In [93]:
print users


{'zcat': 300, 'destiny': 300, 'hunnyb': 300}

In [94]:
users.viewkeys()


Out[94]:
dict_keys(['zcat', 'destiny', 'hunnyb'])

In [95]:
users.viewvalues()


Out[95]:
dict_values([300, 300, 300])

In [96]:
#users.popitem()

In [97]:
users.update()

In [98]:
users.itervalues


Out[98]:
<function itervalues>

In [99]:
users.items()


Out[99]:
[('zcat', 300), ('destiny', 300), ('hunnyb', 300)]

In [100]:
sorted(users)


Out[100]:
['destiny', 'hunnyb', 'zcat']

In [64]:
import re
import sys


file = open(sys.argv[2], "r")

for line in file:
    if re.search(sys.argv[1], line):
        print line,

In [66]:
import re
import sys


file = open(sys.argv[2], "r")

for line in file:
    if re.search(users, line):
        print line,


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-66-805312d3edc5> in <module>()
      6 
      7 for line in file:
----> 8     if re.search(users, line):
      9         print line,

/usr/lib/python2.7/re.pyc in search(pattern, string, flags)
    140     """Scan through string looking for a match to the pattern, returning
    141     a match object, or None if no match was found."""
--> 142     return _compile(pattern, flags).search(string)
    143 
    144 def sub(pattern, repl, string, count=0, flags=0):

/usr/lib/python2.7/re.pyc in _compile(*key)
    227     # internal: compile pattern
    228     cachekey = (type(key[0]),) + key
--> 229     p = _cache.get(cachekey)
    230     if p is not None:
    231         return p

TypeError: unhashable type: 'dict'

In [70]:
from collections import defaultdict

data_dict = defaultdict(list)
for keyStr, load_val in users:
    data_dict[keyStr].append(load_val)


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-70-2c1e4fd6c5cc> in <module>()
      2 
      3 data_dict = defaultdict(list)
----> 4 for keyStr, load_val in users:
      5     data_dict[keyStr].append(load_val)

ValueError: too many values to unpack

In [75]:
if data in users:
    print 'hi'


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-75-36df95e1949d> in <module>()
----> 1 if data in users:
      2     print 'hi'

NameError: name 'data' is not defined

In [ ]: