[英]Can I ask pep8 in python to parse a string instead of a file?
import pep8
s = """
def a:
pass
def b:
pass
"""
pep8.StyleGuide().is_such_method_exists_for_string_?(s)
//然后,將其作為list放出?
import pep8
lines = """
def a:
pass
def b:
pass
"""
checker = pep8.Checker(
lines=lines.strip().splitlines(),
filename=None,
show_source=True
)
result = checker.check_all()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.