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

In [2]:
print hosName


localhost

In [3]:
import time

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


Out[4]:
'12/22/14,11:12'

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


Mon Dec 22 11:12:31 2014

In [6]:
import os

In [7]:
os.getuid()


Out[7]:
1000

In [8]:
import getpass

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

In [10]:
print userName


wcmckee

In [11]:
import random

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

In [13]:
time.sleep(pauseScript)

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

In [15]:
print user


e

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


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

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

In [18]:
print users


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

In [19]:
users.viewkeys()


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

In [20]:
users.viewvalues()


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

In [21]:
#users.popitem()

In [22]:
users.update()

In [23]:
users.itervalues


Out[23]:
<function itervalues>

In [24]:
users.items()


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

In [25]:
sorted(users)


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

In [26]:
import re
import sys


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

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

In [27]:
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-27-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 [28]:
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-28-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 [29]:
if data in users:
    print 'hi'


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

NameError: name 'data' is not defined

In [29]:


In [ ]: