python代码中的多值

2024-05-16 15:06:07 发布

您现在位置:Python中文网/ 问答频道 /正文

感谢所有阅读这篇文章的人 我的问题是如何在python中传递qrcode中的多个值,我正在使用python qrcode库

def create_qr(data):
    qr = qrcode.QRCode(
        version=1,
        error_correction=qrcode.constants.ERROR_CORRECT_L,
        box_size=10,
        border=4,
    )
    qr.add_data(data)
    qr.make(fit=True)
    qr.best_mask_pattern()
    img = qr.make_image(fill_color="red", back_color="white")
    img.save('main.png')

Tags: imgdatamakeversiondefcreateerrorcolor