This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # On branch master | |
| # Changes to be committed: | |
| # (use "git reset HEAD <file>..." to unstage) | |
| # | |
| # modified: ex36_assignment.py | |
| # | |
| # Changes not staged for commit: | |
| # (use "git add/rm <file>..." to update what will be committed) | |
| # (use "git checkout -- <file>..." to discard changes in working directory) | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| class Room: | |
| explored = None | |
| def __init__(self, description): | |
| self.desc = description | |
| def explore(self): | |
| if not self.explored: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import string | |
| with open('C:\Documents and Settings\[trimmed]\Desktop\list.txt', | |
| 'rb') as infile: | |
| fread = infile.readlines() | |
| fread = [x.strip() for x in fread] | |
| fread = [x.lstrip('\x95') for x in fread] | |
| fread = [x.strip() for x in fread] | |
| fread = [x for x in fread if x != ''] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sqlite3 | |
| from collections import defaultdict | |
| DATABASE = 'C:/Misc/myscripts/workprototype/workprototype.db' | |
| conn = sqlite3.connect(database=DATABASE) | |
| comp = conn.execute('select companies.name from companies') | |
| comp = [dict(co_name=row[0]) for row in comp.fetchall()] | |
| prod = conn.execute('select c.name, p.name, c.desc, p.desc from companies c inner join products p on c.co_id = p.co_id') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| numbers = range(10) | |
| for idx, y in enumerate(numbers): | |
| if idx == 1: | |
| continue | |
| else: | |
| print y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| import re | |
| # testreader = csv.DictReader(open('C:/Documents and Settings/' | |
| # 'BJCREASY.SOA/Desktop/test2.csv', 'rb')) | |
| with open('C:/Documents and Settings/' | |
| 'BJCREASY.SOA/Desktop/test2.csv', 'rb') as f: | |
| reader = csv.reader(f) | |
| for row in reader: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| testreader = csv.DictReader(open('C:/Documents and Settings/BJCREASY.SOA/Desktoptestcsv.csv', ''), dialect='excel') | |
| for row in testreader: | |
| print row | |
| # if row['SERFF'] == csv.reader.next().row['SERFF'] | |
| # print 'Success' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| testreader = csv.DictReader(open('test.csv', 'rb') | |
| for row in testreader: | |
| print row |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function loadStockDivs() { | |
| $.getJSON( | |
| "test.php", | |
| "process=loadstocks", | |
| function(data) { | |
| data.counter = 0; | |
| $.each(data.stocks, function(i,stock) { | |
| if (i != 0) { | |
| counter = i; | |
| counterminus = counter-1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // loadSectorOptions works but loadCountryOptions does not | |
| function loadSectorOptions() { | |
| $.getJSON( | |
| "list-process.php", | |
| "process=loadSectorOptions", | |
| function(data) { | |
| $.each(data.sectors, function(i, sector) { | |
| var sectorOption = '<option value=\"' | |
| +sector.sector_id+'\">' |
NewerOlder