省朝夕

           

          python備注點(diǎn)


          1、計(jì)算時(shí)間差:
          import datetime
          starttime = datetime.datetime.now()
          endtime = datetime.datetime.now()
          print (endtime - starttime).seconds
          2、執(zhí)行shell命令:
          import subprocess
          ret = subprocess.Popen(CMD,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
          for line in ret.stdout.readlines():
              print line
          3、簡(jiǎn)單的urllib2使用:
          import urllib2
          res=urllib2.urlopen(url)
          print res.read()

          posted on 2013-01-18 12:03 hejianchao 閱讀(153) 評(píng)論(0)  編輯  收藏 所屬分類: python


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           

          導(dǎo)航

          統(tǒng)計(jì)

          留言簿

          文章分類

          文章檔案

          搜索

          最新評(píng)論

          • 1.?re: Linux-find
          • 評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
          • --hejianchao
          • 2.?re: Linux-cut
          • 看看學(xué)習(xí)下,這么好的文章居然沒(méi)人留言
          • --嬰兒游泳池
          • 3.?re: Linux-cat
          • -s 在某些場(chǎng)合還是比較有用的。
          • --eric.chenjf
          主站蜘蛛池模板: 霸州市| 华蓥市| 香格里拉县| 阿克苏市| 宣威市| 东乡| 北安市| 东乡县| 昭觉县| 万荣县| 曲靖市| 南岸区| 长乐市| 桐乡市| 蒲城县| 烟台市| 来宾市| 庄浪县| 临朐县| 西林县| 巴中市| 高阳县| 云和县| 班戈县| 内黄县| 江城| 宁远县| 柞水县| 思茅市| 墨竹工卡县| 阳曲县| 门源| 临潭县| 舞钢市| 阿合奇县| 桓仁| 布拖县| 密云县| 永德县| 星座| 宁阳县|