Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

This page removed for FERPA compliance
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Modules 101

def modules():
  import os        #Built in
  import random
  import time
  import math      #Built in

  #Find the .jpg files in a directory using os.listdir(directory)
  fileREMOVEDst =  os.listdir('I:\Documents and Settings\Cedric Stallworth\Desktop\REMOVEDb CoC\Classes\Spring 2007\CS1315\Week 1')
  print fileREMOVEDst
  for file in fileREMOVEDst:
    if file.endswith('.jpg'):
      print file

  #Show random.random() module at work
  for i in range(1,10+1):
    print random.random()

  #Show random.shuffle(range) module at work
  for i in range(1,10+1):
    rng = range(1,10+1)
    random.shuffle(rng)
    print rng

  #Show time
  print time.time()
  print time.ctime()


  #A little Math
  print math.pi
  print math.cos(0)
  print math.sin(0)


Link to this Page