當前位置: 首頁>>代碼示例>>Python>>正文


Python bank.Bank類代碼示例

本文整理匯總了Python中bank.Bank的典型用法代碼示例。如果您正苦於以下問題:Python Bank類的具體用法?Python Bank怎麽用?Python Bank使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Bank類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: fetchBankList

    def fetchBankList(self):
        banks = [];
        baseUrl = "http://www.nbcb.com.cn/xyk/thtghd/index%s.shtml";
        for page in range(1, self.getPageRange()):
            url = None;
            if page == 1:
                url = baseUrl % "";
            else:
                url = baseUrl % "_" + str(page);

            soup = self.getSoup(url);
            if not soup:
                break;

            for a in soup.find("div", class_="newslist").find_all("a", class_=""):
                b = Bank();
                b.url = "http://www.nbcb.com.cn" + a["href"].encode("utf-8");
                title = soup_util.getStrings(a);
                m = re.match(r"\[(.*)\]", title);
                if m:
                    b.city = m.group(1);
                b.title = re.sub(r"\[(.*)\]|【(.*)】", "", title);
                banks.append(b);

	return banks;
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:25,代碼來源:nbcb.py

示例2: createBank

def createBank(number=0):
    """Saves a bank with the specified number of accounts.
    Used during testing."""
    bank = Bank()
    for i in xrange(number):
        bank.add(SavingsAccount("Name" + str(i), str(1000 + i), 100.00))
    bank.save("bank.dat")
開發者ID:gregpuzzles1,項目名稱:Sandbox,代碼行數:7,代碼來源:atm.py

示例3: fetchBankList

    def fetchBankList(self):
	prefUrls = ["http://creditcard.hxb.com.cn/hotnews/index.jsp?cid=12347700871250001", "http://creditcard.hxb.com.cn/hotnews/index.jsp?cid=12347701281290003"];
        banks = [];
	for prefUrl in prefUrls:
	    for page in range(0, self.getPageRange()): 
		url = prefUrl + "&page_count=30&page_start=%d" % (page*5);
		soup = self.getSoup(url);

                if not self.isValidSoup(soup):
                    break;

		lis = soup.find_all("div", id="rm_lcd");
		for l in lis:
		    b = Bank();
		    a = l.find("a");
		    b.url = "http://creditcard.hxb.com.cn/hotnews/" + a["href"].encode("utf-8");
		    b.title = a["title"].encode("utf-8").strip();
		    h6 = l.find("h6").string;
                    if h6 != None:
                        m = re.match("\[.*至(.*)\]", h6.encode("utf-8"));
                        if m != None:
                            b.endDate = date_parser.parseDashLineStyle(m.group(1));
		    banks.append(b);

	return banks;
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:25,代碼來源:hxb.py

示例4: test_checking_account

def test_checking_account():
    bank = Bank()
    checkingAccount = Account(CHECKING)
    bill = Customer("Bill").openAccount(checkingAccount)
    bank.addCustomer(bill)
    checkingAccount.deposit(100.0)
    assert_equals(bank.totalInterestPaid(), 0.1)
開發者ID:ShiviBector,項目名稱:abc-bank-python,代碼行數:7,代碼來源:bank_tests.py

示例5: fetchBankList

    def fetchBankList(self):
        banks = [];
        baseUrl = "http://creditcard.pingan.com/cms-tmplt/creditcard/searchPreferentialActivity.do?type=&city=shenzhen&currentPage=%d";
        for page in range(1, self.getPageRange()):
            url = baseUrl % page;
            soup = self.getSoup(url);
            if not soup:
                break;

            lis = soup.find_all("tr", class_="item");
            if len(lis) == 0:
                break;

            for l in lis:
                b = Bank();
                a = l.find("a");
                title = a["title"].encode("utf-8");
                m = re.match(r"\[(.*)\]", title);
                if m:
                    b.city = m.group(1);
                b.title = re.sub(r"【.*】|\[.*\]", "", title);
                b.url = "http://creditcard.pingan.com" + a["href"].encode("utf-8");
                ds = l.contents[-2].string.encode("utf-8");
                b.endDate = date_parser.parseDashLineStyle(ds);
                banks.append(b);
        
        return banks;
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:27,代碼來源:pingan.py

示例6: fetchBankList

    def fetchBankList(self):
        banks = []
        baseUrl = "http://www.bankofshanghai.com/servlet/ServletGate?op=Forward&cur_page=MorePage&target=more&systemModule=1104&cid=110404&page=%d&menuId=&navigation=-%20%25D2%25F8%25D0%25D0%25BF%25A8%25D2%25B5%25CE%25F1%25B6%25AF%25CC%25AC"
        for p in range(1, self.getPageRange()):
            url = (
                "http://www.bankofshanghai.com/servlet/ServletGate?op=Forward&cur_page=MorePage&target=more&systemModule=1104&cid=110404&page="
                + str(p)
                + "&menuId=&navigation=-%20%25D2%25F8%25D0%25D0%25BF%25A8%25D2%25B5%25CE%25F1%25B6%25AF%25CC%25AC"
            )
            soup = self.getSoup(url)
            if not soup or self.isSoupEquals(soup, self.prevSoup):
                break

            self.prevSoup = soup
            for td in soup.find_all("td", bgcolor="#F5F5F5", width="71%"):
                b = Bank()
                a = td.find("a")
                if not a:
                    continue

                b.url = "http://www.bankofshanghai.com/" + a["href"].encode("utf-8")
                b.title = a["title"].encode("utf-8")
                banks.append(b)

        return banks
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:25,代碼來源:shanghai.py

示例7: fetchBankList

	def fetchBankList(self):
		banks = [];
		baseUrls = ["http://xyk.cebbank.com/home/activities/category/a_region_dd/list%d.htm","http://xyk.cebbank.com/home/activities/category/a_life_cycle/list%d.htm",];
		print baseUrls;
		for bu in baseUrls:
			for page in range(1, self.getPageRange()): 
				##url = "http://xyk.cebbank.com/home/activities/category/a_life_cycle/list%d.htm" % page;
				url = bu % page;
				soup = self.getSoup(url);
				if not self.isValidSoup(soup):
					break;

				lis = soup.find("ul", class_="th_list_ul").find_all("div", class_="floatleft");
				for l in lis:
					b = Bank();
					a = l.find("a");
					b.url = "http://xyk.cebbank.com" + a["href"].encode("utf-8");
					title = a.string.encode("utf-8").strip();
					m = re.match(r"(.*?)((.*))", title);
					if m:
						b.title = m.group(1);
						b.city = m.group(2);
					else:
						b.title = title;
					banks.append(b);
		return banks;
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:26,代碼來源:ceb.py

示例8: test_get_account_balance

    def test_get_account_balance(self):
        bank = Bank()

        account1 = Account('001', 50)
        bank.add_account(account1)

        self.assertEqual(bank.get_account_balance('001'), 50)
開發者ID:blocur,項目名稱:pgmain,代碼行數:7,代碼來源:bank_test.py

示例9: test_add_account

    def test_add_account(self):
        bank = Bank()
        account_1 = Account(001, 50)
        account_2 = Account(002, 100)

        bank.add_account(account_1)
        bank.add_account(account_2)
        self.assertEqual(len(bank.accounts), 2)
開發者ID:dmbandola,項目名稱:Bank_Repo,代碼行數:8,代碼來源:bank_test.py

示例10: main

def main(fileName = None):
    """Creates the bank with the optional file name,
    wraps the window around it, and opens the window.
    Saves the bank when the window closes."""
    bank = Bank(fileName)
    print(bank)
    manager = BankManager(bank)
    manager.mainloop()
    bank.save()
開發者ID:staufferl16,項目名稱:Programming111,代碼行數:9,代碼來源:bankmanager.py

示例11: test_deposit

	def test_deposit(self):
		bank = Bank()

		account_1 = Account(001, 50)

		bank.add_account(account_1)

		self.assertEqual(bank.deposit(001, 50), 100)
		self.assertEqual(bank.deposit(002, 50), 'Account does not exist')
開發者ID:anobilisgorse,項目名稱:CSC185,代碼行數:9,代碼來源:bank_test.py

示例12: test_add_account

    def test_add_account(self):
        bank = Bank()

        account1 = Account('001', 20)
        account2 = Account('002', 80)

        bank.add_account(account1)
        bank.add_account(account2)

        self.assertEqual(len(bank.accounts), 2)
開發者ID:blocur,項目名稱:pgmain,代碼行數:10,代碼來源:bank_test.py

示例13: main

def main():
    """Instantiate a bank and use it in an ATM."""
    bank = Bank("bank.dat")
    print "The bank has been loaded"

    atm = ATM(bank)
    print "Running the GUI"
    atm.mainloop()

    bank.save()
    print "The bank has been updated"
開發者ID:gregpuzzles1,項目名稱:Sandbox,代碼行數:11,代碼來源:atm.py

示例14: parseInner

    def parseInner(self, url):
        banks = [];
        soup = self.getSoup(url);

        for a in soup.find("table", class_="ke-zeroborder").find_all("a"):
            b = Bank();
            b.url = a["href"].encode("utf-8");
	    title = a.string.encode("utf-8");
            b.title = self.removeCity(title);
            banks.append(b);
        return banks;
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:11,代碼來源:icbc.py

示例15: fetchBankList

    def fetchBankList(self):
        banks = [];
	soup = self.getSoup("http://creditcard.gzcb.com.cn/Activities3.html", encoding="gbk");
	if not soup:
	    return banks;

	for a in soup.find("div", class_="active_C").find("ul").find_all("a"):
	    b = Bank();
	    b.url = "http://creditcard.gzcb.com.cn/" + a["href"].encode("utf-8");
	    b.title = a.string.encode("utf-8");
	    banks.append(b);

	return banks;
開發者ID:ufo22940268,項目名稱:PromotionScrachServer,代碼行數:13,代碼來源:guangzhou.py


注:本文中的bank.Bank類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。