首页 > 编程语言 >python :生成条形码

python :生成条形码

时间:2022-09-08 02:55:22浏览次数:87  
标签:条形码 format python barcode number 生成 import open ImageWriter

 1 import barcode
 2 from barcode.writer import ImageWriter
 3 
 4 #Define content of the barcode as a string
 5 number = input("Enter the code to generate barcode : ")  #clcoding.com
 6 
 7 #Get the required barcode format
 8 barcode_format = barcode.get_barcode_class('upc')
 9 
10 #Generate barcode and render as image
11 my_barcode = barcode_format(number, writer=ImageWriter())  
12 
13 #Save barcode as PNG
14 my_barcode.save("generated_barcode")
15 from PIL import Image #to open the barcde and show
16 Image.open('generated_barcode.png')

 

标签:条形码,format,python,barcode,number,生成,import,open,ImageWriter
From: https://www.cnblogs.com/ZY-LunarCrater/p/16667928.html

相关文章

  • Python话题抓取
    话题抓取通过话题入口抓取话题下所有问题和回答数据存储MySQL:topicquestionanswer数据抓取requwsts/xpath/re配置maccookie解密chromecookie文件变更https......
  • Python中的类与对象
    类的创建classStudent native_place='吉林' def__init__(self,name,age): self.name=name#把局部变量name的值赋给实体属性self.name self.age=age#实例方法......
  • CF 和 ddns(python程序)
    cfhttps://blog.csdn.net/zhyl8157121/article/details/100551592ddnshttps://blog.zeruns.tech/archives/507.html......
  • python3 - Django3.2框架
    提示:web开发已有php、java,而python在这方面,没有优势,python的优势在于:爬虫、人工智能、大数据分析等,python在web开发这方面,没必要掌握;版本:稳定版本:3.2(py3.6-3.10)、4.2(py3.9-......
  • python自动化测试系列教程
    随着互联网产品更新迭代加快,Web开发和测试的需求也越来越大。很难想象,如果阿里的双11、京东的618,这些庞大繁杂的系统,由工程师们一个个手动测试,将会是一个怎样费时费力、......
  • VSCode SSH Python 加载很慢的解决方法
    更改服务器设置!把LanhuageServer换一下就行了......
  • pythonⅣ
    package:针对代码结构的组织,一个包里面可以拥有很多的python文件module:一个python文件就是一个模块        一个模块想引用另外一个模块里的代码,怎么实......
  • 学习python-Day56
    今日学习内容补充:JSON知识点JSON是JavaScript(JavaScriptObjectNotation)是轻量级的文本数据交换的格式,JSON解析器和JSON支持许多不同的编程语言。独立于其......
  • 第六章 6 函数-迭代器与生成器 练习题
    第六章6函数-迭代器与生成器练习题[基础知识]1说说python中装饰器、迭代器的用法;描述下dict的items()方法与iteritems()方法的不同;解答:装饰器:装饰器是指对函数......
  • python学习(常用库与IO操作)
    一、模块与包1、定义:package:针对代码结构的组织,一个包里面可以拥有很多的python文件module:一个python文件就是一个模块 2、概念:    二、模块之间的引用一......