Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -60,13 +60,12 @@ def calculate_xp(level):
|
|
| 60 |
async def search_csv(file_path, column_index, search_value):
|
| 61 |
with open(file_path, 'r', newline='') as csvfile:
|
| 62 |
reader = csv.reader(csvfile)
|
| 63 |
-
|
|
|
|
| 64 |
for row in reader:
|
| 65 |
if row and len(row) > column_index and row[column_index] == search_value:
|
| 66 |
print(row)
|
| 67 |
-
return row
|
| 68 |
|
| 69 |
-
return None
|
| 70 |
|
| 71 |
|
| 72 |
def is_csv_empty(file_path):
|
|
@@ -130,10 +129,17 @@ async def add_exp(member_id):
|
|
| 130 |
|
| 131 |
|
| 132 |
csv_file_path = 'data.csv'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
if is_csv_empty(csv_file_path):
|
| 134 |
print(f"The CSV file '{csv_file_path}' exists and has data.")
|
| 135 |
else:
|
| 136 |
-
print(f"The CSV file '{csv_file_path}' does not exist or is empty.")
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
|
| 139 |
|
|
|
|
| 60 |
async def search_csv(file_path, column_index, search_value):
|
| 61 |
with open(file_path, 'r', newline='') as csvfile:
|
| 62 |
reader = csv.reader(csvfile)
|
| 63 |
+
first_row = next(reader)
|
| 64 |
+
print(first_row)
|
| 65 |
for row in reader:
|
| 66 |
if row and len(row) > column_index and row[column_index] == search_value:
|
| 67 |
print(row)
|
|
|
|
| 68 |
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
def is_csv_empty(file_path):
|
|
|
|
| 129 |
|
| 130 |
|
| 131 |
csv_file_path = 'data.csv'
|
| 132 |
+
await search_csv(csv_file_path, column_index_to_search, value_to_search)
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
"""
|
| 136 |
if is_csv_empty(csv_file_path):
|
| 137 |
print(f"The CSV file '{csv_file_path}' exists and has data.")
|
| 138 |
else:
|
| 139 |
+
print(f"The CSV file '{csv_file_path}' does not exist or is empty.")
|
| 140 |
+
|
| 141 |
+
"""
|
| 142 |
+
|
| 143 |
|
| 144 |
|
| 145 |
|