Vehicle Identification Number(VIN):
Random vin numbers: VIN stands for Vehicle Identification Number, and it is a 17-digit alphanumeric number that contains both digits and alphabets.
VIN confirms our car’s identity, but it also provides additional purposes:
- It is commonly used in warranty claims.
- In the event of a theft or an insurance claim.
- As well as for track calls.
Before we begin, we must first install the vininfo module in our system.
Installation:
pip install vininfo
Output:
Collecting vininfo Downloading vininfo-1.7.0-py2.py3-none-any.whl (20 kB) Installing collected packages: vininfo Successfully installed vininfo-1.7.0
- How to Get the Count of Number of Pages in a PDF File in Python?
- How to Find the Page Number of a Text from a PDF File in Python?
- Python Program to Generate Strong Numbers in an Interval
Extracting Car Information from VIN Number in Python
Approach:
- Import Vin function from VIN info using the import function
- Pass some random VIN number to the Vin() function to create an object and store it in a variable
- Apply country attribute on the above vin number to get the country to whcih the vehicle belongs to.
- Apply manufacturer attribute on the above vin number to get the manufacturer name
- Apply wmi attribute on the above vin number to get the model name
- Apply vds attribute on the above vin number to get the Plant name
- Apply vis attribute on the above vin number to get the Serial Number
- Apply region attribute on the above vin number to get the region name i.e, in which continent the vehicle is manufactured.
- The Exit of the Program.
Below is the implementation:
# Import Vin function from vininfo using the import function from vininfo import Vin # Pass some random VIN number to the Vin() function to create an object # and store it in a variable vin_numbr = Vin('MAJGERTYKGHG58025') print("Vehicle information using VIN number:\n") # Apply country attribute on the above vin number to get # the country to whcih the vehicle belongs to. print("Country Name:", vin_numbr.country) # Apply manufacturer attribute on the above vin number to get # the manufacturer name print("Manufacturer Name:", vin_numbr.manufacturer) # Apply wmi attribute on the above vin number to get # the model name print("Model:", vin_numbr.wmi) # Apply vds attribute on the above vin number to get # the Plant name print("Plant:", vin_numbr.vds) # Apply vis attribute on the above vin number to get # the Serial Number print("Serial Number:", vin_numbr.vis) # Apply region attribute on the above vin number to get # the region name i.e, in which continent the vehicle is manufactured. print("Region Name: ", vin_numbr.region)
Output:
Vehicle information using VIN number: Country Name: India Manufacturer Name: FordS Model: MAJ Plant: GERTYK Serial Number: GHG58025 Region Name: Asia
Here,
vin_numbr is an object from which we are extracting various vehicle-related information.
- wmi is an abbreviation for world manufacturer identifier
- vds is an abbreviation for the vehicle descriptor section
- vis is an abbreviation for the vehicle identification section.
The vin_numbr .region in the code denotes the continent in which the car is made.