Home‎ > ‎Scripting‎ > ‎


stuff goes here

Installing python

Go to https://www.python.org/ Download python 2.7 run installer
Add the following to PATH
[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27\;C:\Python27\Scripts\", "User")

Install PyCharm

open pycharm
add python interpreters
click install setuptools
click install pop

Installing Modules

run command prompt as administrator
pip install virtualenv
pip install virtualenvwrapper-powershell

in powershell
pip install virtualenv
pip install virtualenvwrapper-powershell
Get-Command *virtualenv*

mkdir '~\.virtualenvs'
Import-Module VirtualEnvWrapper
New-VirtualEnvironment TestEnv
pip install SOAPpy

Set virtual Environment

in Powershell
Set-VirtualEnvironment TestEnv
in command prompt

pip install ipython
pip install ipython[notebook]

installing numpy for python 2.x requires Visual Studio 2008 
    For 2.x, it is expected to fail at that point, since you can't build C extensions with something different than 2008 (with python.org builds).
pip install numpy
pip install pandas

pip list

pip install ipython --upgrade
pip install ipython[notebook] --upgrade
pip install jsonschema

get a list of module attributes/methods

import sys

make dir() more readable
join the output with newlines so that it prints 1 per line
print "\n".join(dir(r))


udacity web developement course notes

months = ['January',
def valid_month(month):
        if month.capitalize() in months:
        return month.capitalize()
    return None

print valid_month("january")
print valid_month("blah")

def valid_day(day):
    if day and day.isdigit:
      int_day = int(day) 
      if int_day > 0 and int_day <= 31:
        return int_day

print valid_day('0')

def valid_year(year):
    if year and year.isdigit():
        year = int(year)
        if year >= 1900 and year <= 2020:
            return year

print valid_year('1900')


environments = {
'env1': {
   'net_root': "/files/usr", 
'net_path': "/files/usr/domain"
'env2': {
   'net_root': "/files/usr", 
'net_path': "/files/usr/domain"