欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

Python日常學(xué)習(xí)雜記

系統(tǒng) 1677 0

Python日常學(xué)習(xí)雜記

  • python -c 的作用

在命令行里執(zhí)行python時(shí),如果加上 -c ,即

            
              python -c xxx

            
          

那么,xxx就被當(dāng)做一條指令(command)來(lái)執(zhí)行,否則,就當(dāng)做腳本路徑,去找script,然后執(zhí)行里面的內(nèi)容。比如:

            
              $ python 
              
                'import this'
              
              
/root/anaconda3/bin/python3.7: can
              
                't open file '
              
              
                import
              
               this': 
              
                [
              
              Errno 2
              
                ]
              
               No such 
              
                file
              
               or directory

            
          

這里就把這個(gè)string作為路徑去找了,沒(méi)有找到文件。如果加上 -c 的話,就當(dāng)做一條python命令執(zhí)行了。

            
              $ python -c 
              
                'import this'
              
              
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren
              
                't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you'
              
              re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it
              
                's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let'
              
              s 
              
                do
              
              
                more
              
               of those
              
                !
              
            
          

2019-08-14 16:20:00

  • autopep8自動(dòng)代碼格式修改工具

鏈接:https://pypi.org/project/autopep8/

PEP8是Python的編碼規(guī)范。https://www.python.org/dev/peps/pep-0008/

利用autopep8,可以自動(dòng)將Python腳本整理成符合PEP8規(guī)范。

用法

            
              autopep8 --in-place -r  --aggressive 文件夾名

            
          

options列表如下:

            
              usage: autopep8 
              
                [
              
              -h
              
                ]
              
              
                [
              
              --version
              
                ]
              
              
                [
              
              -v
              
                ]
              
              
                [
              
              -d
              
                ]
              
              
                [
              
              -i
              
                ]
              
              
                [
              
              --global-config filename
              
                ]
              
              
                [
              
              --ignore-local-config
              
                ]
              
              
                [
              
              -r
              
                ]
              
              
                [
              
              -j n
              
                ]
              
              
                [
              
              -p n
              
                ]
              
              
                [
              
              -a
              
                ]
              
              
                [
              
              --experimental
              
                ]
              
              
                [
              
              --exclude globs
              
                ]
              
              
                [
              
              --list-fixes
              
                ]
              
              
                [
              
              --ignore errors
              
                ]
              
              
                [
              
              --select errors
              
                ]
              
              
                [
              
              --max-line-length n
              
                ]
              
              
                [
              
              --line-range line line
              
                ]
              
              
                [
              
              --hang-closing
              
                ]
              
              
                [
              
              --exit-code
              
                ]
              
              
                [
              
              files 
              
                [
              
              files 
              
                ..
              
              .
              
                ]
              
              
                ]
              
              

Automatically formats Python code to conform to the PEP 8 style guide.

positional arguments:
  files                 files to 
              
                format
              
               or 
              
                '-'
              
              
                for
              
               standard 
              
                in
              
              

optional arguments:
  -h, --help            show this 
              
                help
              
               message and 
              
                exit
              
              
  --version             show program
              
                's version number and exit
  -v, --verbose         print verbose messages; multiple -v result in more
                        verbose messages
  -d, --diff            print the diff for the fixed source
  -i, --in-place        make changes to files in place
  --global-config filename
                        path to a global pep8 config file; if this file does
                        not exist then this is ignored (default:
                        ~/.config/pep8)
  --ignore-local-config
                        don'
              
              t 
              
                look
              
              
                for
              
               and apply local config files
              
                ;
              
              
                if
              
               not
                        passed, defaults are updated with any config files 
              
                in
              
              
                        the project's root directory
  -r, --recursive       run recursively over directories
              
                ;
              
               must be used with
                        --in-place or --diff
  -j n, --jobs n        number of parallel 
              
                jobs
              
              
                ;
              
               match CPU count 
              
                if
              
               value is
                        
              
                less
              
               than 1
  -p n, --pep8-passes n
                        maximum number of additional pep8 passes 
              
                (
              
              default:
                        infinite
              
                )
              
              
  -a, --aggressive      
              
                enable
              
               non-whitespace changes
              
                ;
              
               multiple -a result 
              
                in
              
              
                more
              
               aggressive changes
  --experimental        
              
                enable
              
               experimental fixes
  --exclude globs       exclude file/directory names that match these comma-
                        separated globs
  --list-fixes          list codes 
              
                for
              
               fixes
              
                ;
              
               used by --ignore and --select
  --ignore errors       
              
                do
              
               not fix these errors/warnings 
              
                (
              
              default:
                        E226,E24,W50,W690
              
                )
              
              
  --select errors       fix only these errors/warnings 
              
                (
              
              e.g. E4,W
              
                )
              
              
  --max-line-length n   
              
                set
              
               maximum allowed line length 
              
                (
              
              default: 79
              
                )
              
              
  --line-range line line, --range line line
                        only fix errors found within this inclusive range of
                        line numbers 
              
                (
              
              e.g. 1 99
              
                )
              
              
                ;
              
               line numbers are indexed at
                        1
  --hang-closing        hang-closing option passed to pycodestyle
  --exit-code           change to behavior of 
              
                exit
              
               code. default behavior of
                        
              
                return
              
               value, 0 is no differences, 1 is error exit.
                        
              
                return
              
               2 when add this option. 2 is exists
                        differences.

            
          

2019-08-26 10:45:14

  • 為文件名添加時(shí)間
            
              
                import
              
               datetime
jetzt 
              
                =
              
               str
              
                (
              
              datetime.date.today
              
                (
              
              
                ))
              
              
print
              
                (
              
              jetzt
              
                )
              
              
                >>
              
              
                >
              
               2019-08-28

            
          

可以將日期附到文件名中,便于日后根據(jù)時(shí)間查找。

2019-08-28 11:24:06


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 欧美亚洲一区二区三区在线 | 丁香婷婷亚洲六月综合色 | 99热这里只有精品8 免费看搡女人的视频 | 在线色网 | 精品免费久久久久久成人影院 | 天天干视频网站 | av影音资源 | 九九久久国产精品 | 日本黄色不卡视频 | 成人免费毛片aaaaaa片 | 亚洲人成亚洲人成在线观看 | 国内外一级毛片 | 国产一区欧美 | 欧美一级在线免费 | 免费国产一区二区三区 | 欧美一级全黄 | 97碰碰碰| 欧美激情在线观看一区二区三区 | 亚洲国产最新 | 亚洲综合五月天激动情网 | 91久久精品日日躁夜夜躁国产 | 最新高清无码专区 | 波多野结衣在线免费 | 日本三级带日本三级带黄国产 | 九九99在线视频 | 一区二区三区视频在线 | 私房色播| 精品一卡2卡三卡4卡免费视频 | 午夜爽爽性刺激一区二区视频 | 欧美一级电影在线播放 | 精品国产欧美一区二区 | 亚洲成片在线观看12345ba | 欧美一区二区三区大片 | 国产精品美女久久久久aⅴ国产馆 | 中文字幕一区二区视频 | 小明永久免费 | 狠狠做深爱婷婷久久一区 | 欧美日韩不卡 | 欧美日韩无线码免费播放 | 亚洲一区二区视频在线观看 | 毛片在线不卡 |