python筆記(1) 關(guān)于我們應(yīng)不應(yīng)該繼續(xù)學(xué)習(xí)python
更新時間:2012年10月24日 21:55:27 作者:
關(guān)于Python,如果你要學(xué)習(xí),建議大家查看一下網(wǎng)站:因?yàn)楸救艘彩莿倓倹Q定收集點(diǎn)零碎時間來學(xué)習(xí)下它,推薦可能并不是最好的
以前面試的時候會被問到,linux熟不熟呀?對于這種問題:我總會尷尬地回答,“額..了解一點(diǎn)”。
然而,我大學(xué)畢業(yè)的時候,連linux的虛擬機(jī)都沒裝過,更別提系統(tǒng)熟不熟悉了。雖然我了解一點(diǎn)這個系統(tǒng)可以完全通過命令來操作。后來工作了,有時候?qū)扅c(diǎn)代碼,svn提交上去,服務(wù)器是Linux的,自己也是在windows上跑跑客戶端。記得有個項(xiàng)目,要求用shell來啟動java程序,你知道那時候我是怎么做的嗎?把他們的shell拿來,問哪幾個地方要改的,然后改下要啟動java類的路徑。ok了,完全不去理解里面的意思。到最后又一次面試的時候,不得不坦白:不是太了解Linux命令。
有人可能會說:Linux命令沒什么難啊?;◣滋鞎r間就好了?,F(xiàn)在的我也會這么和完全不懂Linux的朋友這么說。可是如果我不跨出學(xué)習(xí)命令的第一步。我未來的很長一段時間都不得不在面試的時候再一次尷尬。
回到正題,我們到底該不該去學(xué)習(xí)現(xiàn)在看來沒什么用而確實(shí)是不錯的東西呢?
我的回答是:如果你的確是有余力,并愿意向自己投資的話,我覺得是有必要的。
1,這種額外的學(xué)習(xí)會讓你的周末變得充實(shí)。
2,當(dāng)學(xué)習(xí)到一定程度的時候,會對事物有新的看法。
3,面試的時候,你多了一塊籌碼。
4,有一個理論:學(xué)習(xí)的越多,知道自己不知道的越多。(知識面越廣,你所看到的世界就越大?。?
就像情歌里唱的那樣:”我們一直都忘了要到一座橋,到對方心里瞧一瞧“,我想我們是不是也忘了去到一座橋,去別的地方瞧一瞧呢!呵呵
所以讓我們一起進(jìn)入PYTHON世界吧!
python筆記(1)
關(guān)于Python,如果你要學(xué)習(xí),建議大家查看一下網(wǎng)站:(因?yàn)楸救艘彩莿倓倹Q定收集點(diǎn)零碎時間來學(xué)習(xí)下它,推薦可能并不是最好的)
http://book.huihoo.com/dive-into-python/5.4_zh-cn/html/toc/index.html 《Dive to python》
http://docs.python.org/
http://woodpecker.org.cn/
http://code.google.com/intl/zh-CN/edu/languages/google-python-class/introduction.html
剛接觸python我覺得很棒,因?yàn)榘惭b個軟件,馬上就能來個HelloWorld!
也許我們早就過了興奮的年紀(jì),事實(shí)上,我是想說python絕對是讓你放輕松學(xué)習(xí)的語言。
1,函數(shù)聲明用 def
def buildConnectionString(params):
2,導(dǎo)入模塊:import
import odbchelper
在導(dǎo)入模塊時是python編譯器去自己的環(huán)境變量制定的路徑路去找這個模塊,如果要導(dǎo)入的模塊是自定義的路徑下,就必須把這個路徑先放進(jìn)環(huán)境變量中去。
import sys
sys.path.append('/my/new/path')
3,if_else語句:(python通過縮進(jìn)來控制代碼塊,代替了java中的“{}”)
if n > 1:
return n * fib(n - 1)
else:
print 'end of the line'
return 1
4,內(nèi)置數(shù)據(jù)類型List:
List li = ["a", "b", "mpilgrim", "z", "example"]
用“[]”包起來。
A.用for var in list,可以遍歷一個list。在遍歷的時候不要試著增加和刪除元素哦!
squares = [1, 4, 9, 16]
sum = 0
for num in squares:
sum += num
print sum ## 30
B.用in來判斷一個元素是否在list中:
list = ['larry', 'curly', 'moe']
if 'curly' in list:
print 'yay
C.list其他的方法:
list.append(elem) -- adds a single element to the end of the list. Common error: does not return the new list, just modifies the original.
list.insert(index, elem) -- inserts the element at the given index, shifting elements to the right.
list.extend(list2) adds the elements in list2 to the end of the list. Using + or += on a list is similar to using extend().
list.index(elem) -- searches for the given element from the start of the list and returns its index. Throws a ValueError if the element does not appear (use "in" to check without a ValueError).
list.remove(elem) -- searches for the first instance of the given element and removes it (throws ValueError if not present)
list.sort() -- sorts the list in place (does not return it). (The sorted() function shown below is preferred.)
list.reverse() -- reverses the list in place (does not return it)
list.pop(index) -- removes and returns the element at the given index. Returns the rightmost element if index is omitted (roughly the opposite of append()).
D.其他關(guān)于list的例子:
list = ['larry', 'curly', 'moe']
list.append('shemp') ## append elem at end
list.insert(0, 'xxx') ## insert elem at index 0
list.extend(['yyy', 'zzz']) ## add list of elems at end
print list ## ['xxx', 'larry', 'curly', 'moe', 'shemp', 'yyy', 'zzz']
print list.index('curly') ## 2
list.remove('curly') ## search and remove that element
list.pop(1) ## removes and returns 'larry'
print list ## ['xxx', 'moe', 'shemp', 'yyy', 'zzz']
本文純粹的目的是想讓更多的人去學(xué)習(xí)他們可能因各種借口拒絕學(xué)習(xí)的東西。
希望你能被我我的鼓動,而有所行動哦!
然而,我大學(xué)畢業(yè)的時候,連linux的虛擬機(jī)都沒裝過,更別提系統(tǒng)熟不熟悉了。雖然我了解一點(diǎn)這個系統(tǒng)可以完全通過命令來操作。后來工作了,有時候?qū)扅c(diǎn)代碼,svn提交上去,服務(wù)器是Linux的,自己也是在windows上跑跑客戶端。記得有個項(xiàng)目,要求用shell來啟動java程序,你知道那時候我是怎么做的嗎?把他們的shell拿來,問哪幾個地方要改的,然后改下要啟動java類的路徑。ok了,完全不去理解里面的意思。到最后又一次面試的時候,不得不坦白:不是太了解Linux命令。
有人可能會說:Linux命令沒什么難啊?;◣滋鞎r間就好了?,F(xiàn)在的我也會這么和完全不懂Linux的朋友這么說。可是如果我不跨出學(xué)習(xí)命令的第一步。我未來的很長一段時間都不得不在面試的時候再一次尷尬。
回到正題,我們到底該不該去學(xué)習(xí)現(xiàn)在看來沒什么用而確實(shí)是不錯的東西呢?
我的回答是:如果你的確是有余力,并愿意向自己投資的話,我覺得是有必要的。
1,這種額外的學(xué)習(xí)會讓你的周末變得充實(shí)。
2,當(dāng)學(xué)習(xí)到一定程度的時候,會對事物有新的看法。
3,面試的時候,你多了一塊籌碼。
4,有一個理論:學(xué)習(xí)的越多,知道自己不知道的越多。(知識面越廣,你所看到的世界就越大?。?
就像情歌里唱的那樣:”我們一直都忘了要到一座橋,到對方心里瞧一瞧“,我想我們是不是也忘了去到一座橋,去別的地方瞧一瞧呢!呵呵
所以讓我們一起進(jìn)入PYTHON世界吧!
python筆記(1)
關(guān)于Python,如果你要學(xué)習(xí),建議大家查看一下網(wǎng)站:(因?yàn)楸救艘彩莿倓倹Q定收集點(diǎn)零碎時間來學(xué)習(xí)下它,推薦可能并不是最好的)
http://book.huihoo.com/dive-into-python/5.4_zh-cn/html/toc/index.html 《Dive to python》
http://docs.python.org/
http://woodpecker.org.cn/
http://code.google.com/intl/zh-CN/edu/languages/google-python-class/introduction.html
剛接觸python我覺得很棒,因?yàn)榘惭b個軟件,馬上就能來個HelloWorld!
也許我們早就過了興奮的年紀(jì),事實(shí)上,我是想說python絕對是讓你放輕松學(xué)習(xí)的語言。
1,函數(shù)聲明用 def
復(fù)制代碼 代碼如下:
def buildConnectionString(params):
2,導(dǎo)入模塊:import
復(fù)制代碼 代碼如下:
import odbchelper
在導(dǎo)入模塊時是python編譯器去自己的環(huán)境變量制定的路徑路去找這個模塊,如果要導(dǎo)入的模塊是自定義的路徑下,就必須把這個路徑先放進(jìn)環(huán)境變量中去。
復(fù)制代碼 代碼如下:
import sys
sys.path.append('/my/new/path')
3,if_else語句:(python通過縮進(jìn)來控制代碼塊,代替了java中的“{}”)
復(fù)制代碼 代碼如下:
if n > 1:
return n * fib(n - 1)
else:
print 'end of the line'
return 1
4,內(nèi)置數(shù)據(jù)類型List:
List li = ["a", "b", "mpilgrim", "z", "example"]
用“[]”包起來。
A.用for var in list,可以遍歷一個list。在遍歷的時候不要試著增加和刪除元素哦!
復(fù)制代碼 代碼如下:
squares = [1, 4, 9, 16]
sum = 0
for num in squares:
sum += num
print sum ## 30
B.用in來判斷一個元素是否在list中:
復(fù)制代碼 代碼如下:
list = ['larry', 'curly', 'moe']
if 'curly' in list:
print 'yay
C.list其他的方法:
復(fù)制代碼 代碼如下:
list.append(elem) -- adds a single element to the end of the list. Common error: does not return the new list, just modifies the original.
list.insert(index, elem) -- inserts the element at the given index, shifting elements to the right.
list.extend(list2) adds the elements in list2 to the end of the list. Using + or += on a list is similar to using extend().
list.index(elem) -- searches for the given element from the start of the list and returns its index. Throws a ValueError if the element does not appear (use "in" to check without a ValueError).
list.remove(elem) -- searches for the first instance of the given element and removes it (throws ValueError if not present)
list.sort() -- sorts the list in place (does not return it). (The sorted() function shown below is preferred.)
list.reverse() -- reverses the list in place (does not return it)
list.pop(index) -- removes and returns the element at the given index. Returns the rightmost element if index is omitted (roughly the opposite of append()).
D.其他關(guān)于list的例子:
復(fù)制代碼 代碼如下:
list = ['larry', 'curly', 'moe']
list.append('shemp') ## append elem at end
list.insert(0, 'xxx') ## insert elem at index 0
list.extend(['yyy', 'zzz']) ## add list of elems at end
print list ## ['xxx', 'larry', 'curly', 'moe', 'shemp', 'yyy', 'zzz']
print list.index('curly') ## 2
list.remove('curly') ## search and remove that element
list.pop(1) ## removes and returns 'larry'
print list ## ['xxx', 'moe', 'shemp', 'yyy', 'zzz']
本文純粹的目的是想讓更多的人去學(xué)習(xí)他們可能因各種借口拒絕學(xué)習(xí)的東西。
希望你能被我我的鼓動,而有所行動哦!
相關(guān)文章
Django1.11配合uni-app發(fā)起微信支付的實(shí)現(xiàn)
這篇文章主要介紹了Django1.11配合uni-app發(fā)起微信支付的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-10-10
Python實(shí)現(xiàn)Appium端口檢測與釋放的實(shí)現(xiàn)
這篇文章主要介紹了Python實(shí)現(xiàn)Appium端口檢測與釋放的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-12-12
使用python腳本自動創(chuàng)建pip.ini配置文件代碼實(shí)例
這篇文章主要介紹了使用python腳本自動創(chuàng)建pip.ini配置文件代碼實(shí)例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2019-09-09
python計算無向圖節(jié)點(diǎn)度的實(shí)例代碼
今天小編就為大家分享一篇python計算無向圖節(jié)點(diǎn)度的實(shí)例代碼,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-11-11
Python基于機(jī)器學(xué)習(xí)方法實(shí)現(xiàn)的電影推薦系統(tǒng)實(shí)例詳解
這篇文章主要介紹了Python基于機(jī)器學(xué)習(xí)方法實(shí)現(xiàn)的電影推薦系統(tǒng),本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價值,需要的朋友可以參考下2019-06-06
Python基于ImageAI實(shí)現(xiàn)圖像識別詳解
ImageAI是一個面向計算機(jī)視覺編程的Python庫,支持最先進(jìn)的機(jī)器學(xué)習(xí)算法。本文將利用ImageAI實(shí)現(xiàn)圖像識別功能,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下2023-02-02
Python實(shí)現(xiàn)火柴人的設(shè)計與實(shí)現(xiàn)
火柴人(Stick Figure)是一種極簡風(fēng)格的圖形,通常由簡單的線段和圓圈組成,卻能生動地表達(dá)人物的姿態(tài)和動作,本文旨在介紹如何使用Python實(shí)現(xiàn)火柴人的設(shè)計與繪制,通過編程的方式,讓讀者了解火柴人背后的基本原理和實(shí)現(xiàn)方法,需要的朋友可以參考下2024-10-10

