好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > python Autopep8實現按PEP8風格自動排版Python代碼

python Autopep8實現按PEP8風格自動排版Python代碼

熱門標簽:正安縣地圖標注app 電銷機器人系統廠家鄭州 遼寧智能外呼系統需要多少錢 qt百度地圖標注 400電話申請資格 螳螂科技外呼系統怎么用 地圖地圖標注有嘆號 阿里電話機器人對話 舉辦過冬奧會的城市地圖標注

Autopep8是一個將Python代碼自動排版為PEP8風格的小工具。它使用pep8工具來決定代碼中的哪部分需要被排版。Autopep8可以修復大部分pep8工具中報告的排版問題。

參考網址:

https://www.python.org/dev/peps/pep-0008/

https://pypi.python.org/pypi/autopep8/

(1)安裝步驟如下:

localhost:~ a6$ sudo pip install autopep8
Password:
The directory '/Users/a6/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/a6/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting autopep8
Collecting pycodestyle>=2.3 (from autopep8)
 Downloading pycodestyle-2.3.1-py2.py3-none-any.whl (45kB)
  100% |████████████████████████████████| 51kB 324kB/s
Installing collected packages: pycodestyle, autopep8
Successfully installed autopep8-1.3.3 pycodestyle-2.3.1
localhost:~ a6$ sudo pip install autopep8
The directory '/Users/a6/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/a6/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: autopep8 in /Library/Python/2.7/site-packages
Requirement already satisfied: pycodestyle>=2.3 in /Library/Python/2.7/site-packages (from autopep8)

(2)示例代碼:

1)運行命令前代碼的排版 (保存在test_autopep8.py)

import math, sys;
 
def example1():
  ####This is a long comment. This should be wrapped to fit within 72 characters.
  some_tuple=(  1,2, 3,'a' );
  some_variable={'long':'Long code lines should be wrapped within 79 characters.',
  'other':[math.pi, 100,200,300,9876543210,'This is a long string that goes on'],
  'more':{'inner':'This whole logical line should be wrapped.',some_tuple:[1,
  20,300,40000,500000000,60000000000000000]}}
  return (some_tuple, some_variable)
def example2(): return {'has_key() is deprecated':True}.has_key({'f':2}.has_key(''));
class Example3(  object ):
  def __init__  ( self, bar ):
   #Comments should have a space after the hash.
   if bar : bar+=1; bar=bar* bar  ; return bar
   else:
          some_string = """
            Indentation in multiline strings should not be touched.
Only actual code should be reindented.
"""
          return (sys.path, some_string)

2)運行命令

bogon:AB a6$ autopep8 --in-place --aggressive --aggressive test_autopep8.py

3)運行命令后代碼的排版

import math
import sys 
def example1():
  # This is a long comment. This should be wrapped to fit within 72
  # characters.
  some_tuple = (1, 2, 3, 'a')
  some_variable = {
    'long': 'Long code lines should be wrapped within 79 characters.',
    'other': [
      math.pi,
      100,
      200,
      300,
      9876543210,
      'This is a long string that goes on'],
    'more': {
      'inner': 'This whole logical line should be wrapped.',
      some_tuple: [
        1,
        20,
        300,
        40000,
        500000000,
        60000000000000000]}}
  return (some_tuple, some_variable)
 
 
def example2(): return ('' in {'f': 2}) in {'has_key() is deprecated': True};
 
 
class Example3(object):
  def __init__(self, bar):
    # Comments should have a space after the hash.
    if bar:
      bar += 1
      bar = bar * bar
      return bar
    else:
      some_string = """
            Indentation in multiline strings should not be touched.
      Only actual code should be reindented.
      """
      return (sys.path, some_string)

4)參考網址:
https://github.com/hhatto/autopep8

到此這篇關于python Autopep8實現按PEP8風格自動排版Python代碼的文章就介紹到這了,更多相關python Autopep8自動排版內容請搜索腳本之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:
  • Autopep8的使用(python自動編排工具)
  • pycharm配置安裝autopep8自動規范代碼的實現
  • Pycharm配置autopep8實現流程解析

標簽:濟源 合肥 阜新 淘寶好評回訪 隨州 興安盟 信陽 昭通

巨人網絡通訊聲明:本文標題《python Autopep8實現按PEP8風格自動排版Python代碼》,本文關鍵詞  python,Autopep8,實現,按,PEP8,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《python Autopep8實現按PEP8風格自動排版Python代碼》相關的同類信息!
  • 本頁收集關于python Autopep8實現按PEP8風格自動排版Python代碼的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 免费三?片在线播放| 美女用手扒开粉嫩的屁股| 人妻美脚连裤袜日本| 诱咪视频在线观看| 欧美成人乱码视频XXXX| 被两个男的双龙挺进了 | 公主野外被侍卫啪到腿软H| 刺激cijilu福利区在线观看| 手机看片国产免费现在观看| 欧洲熟色妇| 久久久久亚洲AV成人网人人小说| 麻豆91精品一区二区| ??嫩草研究院??国产| 国产精品一区二区三区四区五区| 调教师残忍调教奴h| 末成年美女黄网站色大片连接| 被老男人开嫩苞受不了了| 91国精产品秘?一区二区三区| 男生插女生下面免费视频| 国产精品一线天在线观看| 免费www视频| 少妇偷人高潮A片XXXX| 朱竹清被调教鞭打臀缝| 国内最真实的xxxx人伦| 99精品国产综合久久久久五月天| 少妇被又大又粗又爽黄老大爷小| 吞吐男人胯间的巨物| 97国产精品欧美一区二区三区| 妊娠8ヶ月の美人妊妇| 国产女人第一次做爰毛片| 东北大坑乱H第二部| 后厨美妇雪臀撞击| 人妻91丨PORNY丨绿帽| 午夜黄大色黄大片美女图片| 国内精品久久久久久久97牛牛| 一区二区三区亚洲区| 国产jk制服精品丝袜大白腿| 全部韩国古装三级在线播放| 大老粗与小蛮腰油酥饼| 美女裸体国产一区二区麻豆 | jizz女学|