# Following code is tested on raspberry pi 2
# Installed Rasbian from noobs, you should already have RPi.GPIO module 
import RPi.GPIO as GPIO           # import RPi.GPIO module  
GPIO.setmode(GPIO.BOARD)            # choose BCM or BOARD  
GPIO.setup(31, GPIO.OUT) # set a port/pin as an output   
GPIO.output(31, 1)       # set port/pin value to 1/GPIO.HIGH/True  
GPIO.output(31, 0)       # set port/pin value to 0/GPIO.LOW/False