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

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
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)
  fileList =  os.listdir('I:\Documents and Settings\Cedric Stallworth\Desktop\Job CoC\Classes\Spring 2007\CS1315\Week 1')
  print fileList
  for file in fileList:
    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