0

I was try to create barcode using python. I was try to use pyBarcode library. When i was try to create barcode from value 12345. I got result like 123452 or 123454. But the format what i need it like 13 digit and like 0000001234567 or 1123456000008.

I was try like this :

import barcode

ean = barcode.get_barcode_class("ean13")
ean_final = ean(u"12345")
Scarlett stone
  • 225
  • 1
  • 15
  • EAN-13 takes 12 digits plus 1 check digit, you may fill '0' into your value and the library will calculate the check digit. – M. Leung Aug 10 '17 at 03:15
  • If add '0' like you said,That's like static, right ? i need it as dynamic. There is any library can generate it as automaticaly that i can use ? – Scarlett stone Aug 10 '17 at 03:26
  • Use [str.ljust(width[, fillchar])](http://docs.python.org/library/stdtypes.html#str.ljust) – stovfl Aug 10 '17 at 09:33

0 Answers0