用于使用https://loripsum.net/api生成占位符文本的python模块
py-loremipsum的Python项目详细描述
用于使用loripsum.net API生成占位符文本的python模块。
基本用法
importloremipsum# Generate plain text paragraphs with API default settingsno_options=loremipsum.generate()# Generate 3 medium length paragraphs in plain textplaintext=loremipsum.generate(3,loremipsum.ParagraphLength.MEDIUM)# Generate 1 long paragraph with HTML tagssimple_html=loremipsum.generate(1,loremipsum.ParagraphLength.LONG,plaintext=False)# Generate 1 long paragraph with HTML headers and decorated textoptions=['headers','decorate']decorated_html=loremipsum.generate(1,loremipsum.ParagraphLength.LONG,plaintext=False,html_options=options)
命令行
基本
此包包含loremipsum命令,用于从 命令行。有关命令行选项的详细信息:
loremipsum --help
示例用法
生成3个短段落,并将新行和管道输出到 placeholder.txt:
loremipsum 3 --length short --trailing-newlines > placeholder.txt
生成4个html段落并将输出管道发送到placeholder.html:
loremipsum 4 --html > placeholder.html
复制到剪贴板
此包包含一个附加的lorem-copy命令,用于生成文本和 使用pyperclip将其复制到剪贴板。有关命令行的详细信息 选项:
lorem-copy --help
注意:pyperclip在MacOS和Windows上应该是现成的,但是可能 在Linux发行版上需要一些额外的软件包。先检查their documentation如果 您在使用lorem-copy命令时遇到困难。
有关详细信息,请参见documentation。