-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
30 lines (23 loc) · 887 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import pandas as pd
import csv
def Fallout_Weapon(Weapon):
# Function that finds what weapon you're talking about.
with open('Fallout76.csv', encoding="utf8") as csvfile:
# Opens CSV File.
csv_file = csv.reader(csvfile)
#Reads CSV File.
for row in csv_file:
#Finds the Weapon by going through each row and Column in the CSV file.
if Weapon.upper() in row[0].upper() or row[0].lower().startswith(Weapon.lower()):
return row[0]
# Creates a Dataframe of the CSV File.
df = pd.read_csv('Fallout76.csv')
print(df)
# Takes the name of the weapon.
Name = input("Input the Name of the Weapon. ")
print('\n')
# Searches through the CSV file.
Weapon = Fallout_Weapon(Name)
# If the variable Weapon has a value print out the Weapon.
if Weapon:
print("The Weapon you've chosen is", Weapon)