import qrcode  # 导入二维码的库

# 二维码的内容
content = 'https://www.baidu.com'

# 使用qrcode库中的QRcode模块
qr = qrcode.QRCode()

# 给二维码添加数据
qr.add_data(content)

# 生成二维码
qr.make(fit=True)

#设置二维码颜色,第一个是填充颜色 第二个是背景颜色
image = qr.make_image(fill_color="red", back_color="white")

# 二维码展示
image.show()

# 二维码保存
image.save('qrcode.png')

 

相关文章:

  • 2021-12-16
  • 2021-10-08
  • 2021-11-23
  • 2022-12-23
猜你喜欢
  • 2021-11-25
  • 2022-12-23
  • 2022-02-22
  • 2022-12-23
  • 2021-08-25
相关资源
相似解决方案