程序人生

          撰寫生活代碼,等待編譯美好人生
          隨筆 - 48, 文章 - 0, 評(píng)論 - 29, 引用 - 0
          數(shù)據(jù)加載中……

          2007年8月4日

          Python為自身模塊添加屬性

          試了好半天才始出來(lái),幾經(jīng)曲折,所以寫下來(lái):

          A模塊:
          1?import?sys,?os
          2?selfMod?=?__import__(__name__)
          3?setattr(selfMod,?"field",?"value")


          在B模塊中調(diào)用
          1?import?A
          2?print?A.field
          輸出: value

          模塊A的這種寫法與在模塊A中直接寫field = "value"的效果是一樣的。這看起來(lái)似乎多余,但是在某些特殊的情況下可以用該方法動(dòng)態(tài)設(shè)置當(dāng)前模塊的屬性。



          posted @ 2008-05-20 02:21 405 Studio 閱讀(783) | 評(píng)論 (0)編輯 收藏

          蔬菜沙拉

          前幾天跟朋友去吃了一次蔬菜沙拉。做的很精致,但并不合我的口味,但朋友很喜歡。
          今天閑暇之際研究一下“沙拉”的來(lái)源:
          google了一下"define:沙拉"

          沙拉(香港稱為沙律)通常是配菜,有時(shí)會(huì)作為一道主菜。?

          不詳細(xì),在answers.com找了一下:

          Originally?derived?from?the?Latin?sal? for ?salt,?meaning?something?dipped?into?salt.?Now?normally?a?dish?of?uncooked?vegetables;?either?a?mixed?salad?or?just?one?item?(commonly?lettuce?or?tomato).?
          的確,我們吃的都是卷心菜(當(dāng)時(shí)我以為卷心菜就是生菜 -_-|||)和小西紅柿。

          食物文化百科:
          Although?the?ancient?Greeks?and?Romans?did?not?use?the?word?"salad,"?they?enjoyed?a?variety?of?dishes?with?raw?vegetables?dressed?with?vinegar,?oil,?and?herbs.?Pliny?the?Elder?in?Natural?History,?for?instance,?reported?that?salads?(acetaria)?were?composed?of?those?garden?products?that?"needed?no?fire?for?cooking?and?saved?fuel,?and?which?were?a?resource?to?store?and?always?ready"?(Natural?History,?XIX,?58).?They?were?easy?to?digest?and?were?not?calculated?to?overload?the?senses?or?stimulate?the?appetite.
          ...........
          ...........

          最終,我在懷疑是不是中國(guó)涼拌傳入西方之后變味了的結(jié)果。

          posted @ 2007-12-05 01:43 405 Studio 閱讀(440) | 評(píng)論 (1)編輯 收藏

          感覺(jué)我是無(wú)賴

          這種感覺(jué)不好。。

          posted @ 2007-12-03 22:04 405 Studio 閱讀(262) | 評(píng)論 (0)編輯 收藏

          Windows DB2 Express-C 9 啟動(dòng)不了的原因

          這幾天想嘗試一下 DB2 Express-C 9 ,找了個(gè)Windows的版本,幾個(gè)"下一步"幾個(gè)確定之后就裝玩了. Reboot以下以為可以開始探索DB2 9了.沒(méi)想到DB2卻怎么都啟不來(lái).
          折騰了幾天才知道原來(lái)DB2 服務(wù)的啟動(dòng)還跟系統(tǒng)的一些其他服務(wù)有聯(lián)系于是把在服務(wù)列表中把Server服務(wù)啟動(dòng)了再啟動(dòng)DB2, 啟動(dòng)成功!

          posted @ 2007-08-04 17:05 405 Studio 閱讀(709) | 評(píng)論 (1)編輯 收藏

          主站蜘蛛池模板: 湟中县| 宣威市| 紫阳县| 五寨县| 基隆市| 宁远县| 泸水县| 固原市| 黎平县| 岗巴县| 台前县| 莱西市| 松江区| 龙岩市| 丰台区| 马尔康县| 巴青县| 资兴市| 凤城市| 岑巩县| 西丰县| 开阳县| 黑山县| 濮阳市| 山丹县| 辽阳市| 郧西县| 青河县| 辽源市| 夏津县| 武鸣县| 洛南县| 吉木萨尔县| 神池县| 新余市| 宝丰县| 镇赉县| 兴安盟| 元阳县| 修文县| 兴宁市|