Python学习

国外牛人说要多学习不同的编程语言,感受它们的不同艺术,学习其长短,有利于开拓思维。所以除了JAVA,一直想找另外一门比较轻便的语言来学习,例如,Python!好,让我们坐上 google 旅游大巴,去享受Python吧!

Vamei写的傻瓜基础教程:

http://book.douban.com/doulist/1619790/

学一门语言希望知道为啥它值得学习?与你现在所掌握的有何不同。下面的文章挺好的:

http://blog.segmentfault.com/hlcfan/1190000000361407 (外国人写的图文并茂,国人翻译的)

中国人很多太浮躁。做技术的我希望不要浮躁。Python很简单,但是似乎底层的实现都屏蔽了,作为一名程序员,我还是推荐用JAVA作为职业生涯的学习语言。当然如果你会C那就更好了。


好了,下面介绍下如何在windows下面使用Python:

下载安装:

https://www.python.org/ftp/python/2.7.6/python-2.7.6.msi

安装后都不用设置什么PATH之类的,如何开始编程请看下面:

http://www.crifan.com/files/doc/docbook/python_beginner_tutorial/release/htmls/ch04_python_dev_env.html#how_dev_python_in_window(图文并茂)


bookmark: http://www.cnblogs.com/vamei/archive/2012/07/03/2574436.html

To be continued...


windows下安装cx_Oracle:

1. 百度搜索适用版本的 简易 oracle client ,例如 instantclient-basic-win32-11.2.0.1.0.zip; csdn有资源

2. 解压到某路径,将此路径加入 PATH

3. 百度搜索使用版本的 cx_Oracle , 例如 cx_Oracle-5.1.2-10g.win32-py2.7.msi, 安装

4. 验证:

>>> import cx_Oracle
>>> conn = cx_Oracle.connect("usr/pwd@123.13.23.4:1800/test")
>>> cursor = conn.cursor()
>>> cursor.execute("select 1 from dual")
<__builtin__.OracleCursor on <cx_Oracle.Connection to usr@123.13.23.4:1800/test>>
>>> row = cursor.fetchone()
>>> print row[0]
1
>>> cursor.execute("select * from 888")

Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    cursor.execute("select * from 888")
DatabaseError: ORA-00903: ????

>>> cursor.execute("select * from sales_orders where rownum = 1")
<__builtin__.OracleCursor on <cx_Oracle.Connection to usr@123.13.23.4:1800/test>>
>>> rows = cursor.fetchall()
>>> for row in rows:
	print row

(214237, 100037, 'LS2012090300494abc', '20828031Q6H71', 'DELIVER_ALL', 'FINANCE_AUDIT_YES', 'PRE_DISTRIBUTION_YES', 'DISPATCH_ALL', 'INVOICE_ALL', 'NONE', datetime.datetime(2012, 8, 28, 23, 20, 1), '1', 1, 105287, 124743, 117012, '???', '???', '???', None, '13302607047', None, None, 102878, '???????C175?', '523686', datetime.datetime(2012, 8, 29, 22, 45, 5), None, 1099, 0, '1', 1099, '???', None, None, '???', 102878, '???????C175?', '13302607047', None, None, 'A', '1', None, 'D', None, None, None, 105317, '?????', datetime.datetime(2012, 9, 3, 9, 23, 49), '??', datetime.datetime(2012, 9, 3, 11, 41, 52), 'false', 'false', 'false', 0, None, None, 'SHIPPED_ALL', 'SHIPPED_ALL_OVER', 'PAYED', 'VERIFICATION_ALL', 'NONE', None, 'NONE', 'D', 'D', None, None, None, None, 'ORDER_TRUNED_TO_DO', 0, None, '1', None, None, None, None, None, None, 'DIRECT', None, None, None, None, None, None, None, None, None, None, 118697, None, None, None, None, None, None, None, None, None, None, None, 0, 1, None, None)
>>> print rows[0][0]
214237
>>> print rows[0][2]
LS2012090300494abc
>>> print cursor.rowcount;
1
>>> cursor.close()
>>> conn.close()







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值