程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[python (4), internship experience of Alibaba ant financial 2021 core financial department

編輯:Python
  • Dynamic QR code

  • Function commonly used parameter table

Today I want to share with you a Python Two lines of code to show the operation of small projects , Generate your own beautiful QR code , Including ordinary QR code 、 Art QR code and dynamic QR code with pictures . Let's start with the last wave of renderings :

Ordinary QR code

Art QR code with pictures

Dynamic QR code

Okay , The next step is to see how to use two lines of code to generate your own QR code .

stay Python To generate a two-dimensional code, you need to call MYQR Third party Library , This library can be said to be specially tailored for two-dimensional code , Call the run Function can directly generate the desired two-dimensional code ,

.

Ordinary QR code

========================================================================

To generate a normal QR code, you only need to run Middle feeding words The QR code to be generated can be passed in , For example, we will 360 The browser's main interface generates a QR code : The website is :“https://hao.360.com/”.

Run the following code :


from MyQR import myqr
myqr.run(words='https://hao.360.com/')

Be accomplished , At this time, we can find the generated in the default folder of the program .png Format of the QR code .

.

Art QR code with pictures

============================================================================

When generating art QR code with pictures , We need to add... To the original program picture Parameters , The background image of the QR code we want to set , Use colorized=True Parameter setting picture background color , If you don't set , The default image is black and white background .

We can also use save_name Parameter name the QR code .

It is worth noting that : To avoid image format errors , The format of the named QR code needs to be the same as that of the background image .

For example, we use pictures “mtsc_body15.png” Generate a QR code for the background . The generated QR code is named “qr1.png”

The code is as follows :


from MyQR import myqr
myqr.run(words='https://hao.360.com/',
picture='Sources/mtsc_body15.png',
save_name='qr1.png',
colorized=True)

The effect of the generated QR code is as follows :

.

Last

Hand drawn as shown in the figure below kafka Knowledge outline flow chart (xmind The file can't be uploaded , Export picture presentation ), But you can provide source files to every friend who loves learning , For a link : Free download here

xmind The file can't be uploaded , Export picture presentation ), But you can provide source files to every friend who loves learning , For a link : Free download here

[ Outside the chain picture transfer in …(img-QxmJ01nz-1628508921306)]


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved