国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python筆記(1) 關于我們應不應該繼續學習python

2019-11-25 18:41:59
字體:
來源:轉載
供稿:網友
以前面試的時候會被問到,linux熟不熟呀?對于這種問題:我總會尷尬地回答,“額..了解一點”。

  然而,我大學畢業的時候,連linux的虛擬機都沒裝過,更別提系統熟不熟悉了。雖然我了解一點這個系統可以完全通過命令來操作。后來工作了,有時候寫點代碼,svn提交上去,服務器是Linux的,自己也是在windows上跑跑客戶端。記得有個項目,要求用shell來啟動java程序,你知道那時候我是怎么做的嗎?把他們的shell拿來,問哪幾個地方要改的,然后改下要啟動java類的路徑。ok了,完全不去理解里面的意思。到最后又一次面試的時候,不得不坦白:不是太了解Linux命令。

  有人可能會說:Linux命令沒什么難啊。花幾天時間就好了?,F在的我也會這么和完全不懂Linux的朋友這么說??墒侨绻也豢绯鰧W習命令的第一步。我未來的很長一段時間都不得不在面試的時候再一次尷尬。
  回到正題,我們到底該不該去學習現在看來沒什么用而確實是不錯的東西呢?
  我的回答是:如果你的確是有余力,并愿意向自己投資的話,我覺得是有必要的。
  1,這種額外的學習會讓你的周末變得充實。
  2,當學習到一定程度的時候,會對事物有新的看法。
  3,面試的時候,你多了一塊籌碼。
  4,有一個理論:學習的越多,知道自己不知道的越多。(知識面越廣,你所看到的世界就越大!)

  就像情歌里唱的那樣:”我們一直都忘了要到一座橋,到對方心里瞧一瞧“,我想我們是不是也忘了去到一座橋,去別的地方瞧一瞧呢!呵呵

所以讓我們一起進入PYTHON世界吧!

python筆記(1)

關于Python,如果你要學習,建議大家查看一下網站:(因為本人也是剛剛決定收集點零碎時間來學習下它,推薦可能并不是最好的)

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我覺得很棒,因為安裝個軟件,馬上就能來個HelloWorld!
也許我們早就過了興奮的年紀,事實上,我是想說python絕對是讓你放輕松學習的語言。

1,函數聲明用 def

復制代碼 代碼如下:

def buildConnectionString(params):


2,導入模塊:import

復制代碼 代碼如下:

import odbchelper


在導入模塊時是python編譯器去自己的環境變量制定的路徑路去找這個模塊,如果要導入的模塊是自定義的路徑下,就必須把這個路徑先放進環境變量中去。
復制代碼 代碼如下:

import sys
sys.path.append('/my/new/path')

3,if_else語句:(python通過縮進來控制代碼塊,代替了java中的“{}”)
復制代碼 代碼如下:

if n > 1:
return n * fib(n - 1)
else:
print 'end of the line'
return 1

4,內置數據類型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.其他關于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']

本文純粹的目的是想讓更多的人去學習他們可能因各種借口拒絕學習的東西。
希望你能被我我的鼓動,而有所行動哦!
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 郧西县| 涡阳县| 聂拉木县| 夹江县| 乌鲁木齐县| 五峰| 高唐县| 神木县| 麟游县| 奉化市| 海口市| 渝北区| 通海县| 溆浦县| 汝南县| 密山市| 繁峙县| 营山县| 仁怀市| 阿克| 金塔县| 湖南省| 康定县| 无棣县| 台南市| 武威市| 横山县| 易门县| 南川市| 阳东县| 江北区| 望奎县| 齐齐哈尔市| 高安市| 十堰市| 涟水县| 电白县| 淳化县| 博湖县| 合阳县| 汤阴县|