idea集成python插件
作者:尹正傑
版權聲明:原創作品,謝絕轉載!否則將追究法律責任。
在繼承安裝Python插件時,請確認你是否安裝Python解釋器(Python官網:https://www.python.org/),不管你使用的是哪個版本,安裝方式都是一樣的,關於安裝Python的筆記可以參考:https://www.cnblogs.com/yinzhengjie/p/9106558.html
一.在idea開發環境中安裝Python插件步驟詳解
1>.點擊設置
2>.在線安裝插件
3>.搜索python插件版本
4>.網絡不佳導致安裝失敗咋辦呢?(如果你已經安裝成功了就不用看下面的步驟,idea會提示你重啟它的)
5>.去官網選擇python相應的安裝版本(https://plugins.jetbrains.com/plugin/631-python)
6>.將下載好的插件手動安裝(只需要選擇下載的插件包即可)
7>.確認安裝
8>.重啟idea插件
二.在idea開發環境中進行Python程序開發
1>.新建模塊(選擇python支持)
2>.完成支持python模塊的創建
3>.新建python腳本
4>.編寫python測試代碼
1 #!/usr/bin/env python 2 #_*_coding:utf-8_*_ 3 #@author :yinzhengjie 4 #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/ 5 #EMAIL:y1053419035@qq.com 6 7 end = input("你想要打印乘法表是:") 8 9 row = 1 10 while row <= end: 11 col = 1 12 while col <= row: 13 print str(col) + "x" + str(row) + "=" + str(row * col) + "\t", 14 col += 1 15 print 16 row += 1 17 18 19 20 21 ''' 22 以上代碼執行結果如下: 23 你想要打印乘法表是:9 24 1x1=1 25 1x2=2 2x2=4 26 1x3=3 2x3=6 3x3=9 27 1x4=4 2x4=8 3x4=12 4x4=16 28 1x5=5 2x5=10 3x5=15 4x5=20 5x5=25 29 1x6=6 2x6=12 3x6=18 4x6=24 5x6=30 6x6=36 30 1x7=7 2x7=14 3x7=21 4x7=28 5x7=35 6x7=42 7x7=49 31 1x8=8 2x8=16 3x8=24 4x8=32 5x8=40 6x8=48 7x8=56 8x8=64 32 1x9=9 2x9=18 3x9=27 4x9=36 5x9=45 6x9=54 7x9=63 8x9=72 9x9=81 33 '''
執行以上代碼,測試結果如下:
5>.小試牛刀
現在賣公雞5元/1只,母雞3元/1只,小雞1元/3只,請問:100元錢剛好買100只雞,有幾種賣法?

#!/usr/bin/env python #_*_coding:utf-8_*_ #@author :yinzhengjie #blog:http://www.cnblogs.com/yinzhengjie/tag/python%E8%87%AA%E5%8A%A8%E5%8C%96%E8%BF%90%E7%BB%B4%E4%B9%8B%E8%B7%AF/ #EMAIL:y1053419035@qq.com ''' cock = 5元/只 hen = 3元/只 chicken= 1/3只 ''' cock = 0 hen = 0 chicken = 0 for x in range(0 , 20 + 1): for y in range(0 , 34) : for z in range(0 , 301 , 3): sum = x * 5 + 3 * y + z / 3 count = x + y + z zz = z / 3 if sum == 100 and count == 100: print "公雞 : " + str(x) + ", 母雞 : "+str(y) + " , 小雞 : " +str(z)