lunarflu HF staff commited on
Commit
15fca77
1 Parent(s): 0ac459c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -354,6 +354,8 @@ async def test3(ctx):
354
  csv_writer = csv.writer(csv_file)
355
  csv_writer.writerows(values)
356
 
 
 
357
  with open(csv_file_path, 'r') as csv_file:
358
  csv_reader = csv.reader(csv_file)
359
  #rows = list(csv_reader)
@@ -376,6 +378,17 @@ async def test3(ctx):
376
  break
377
 
378
 
 
 
 
 
 
 
 
 
 
 
 
379
 
380
 
381
 
 
354
  csv_writer = csv.writer(csv_file)
355
  csv_writer.writerows(values)
356
 
357
+
358
+ # modifying csv data
359
  with open(csv_file_path, 'r') as csv_file:
360
  csv_reader = csv.reader(csv_file)
361
  #rows = list(csv_reader)
 
378
  break
379
 
380
 
381
+ # write modified data and send in discord
382
+ with open(csv_file_path, 'w', newline='') as csv_file:
383
+ csv_writer = csv.writer(csv_file)
384
+ csv_writer.writerows(rows)
385
+
386
+ csv_data_str = '\n'.join(','.join(row) for row in rows)
387
+ csv_file = discord.File(csv_file_path)
388
+ target_user = await bot.fetch_user(int(target_id))
389
+
390
+ await target_user.send(content="csv", file=csv_file)
391
+
392
 
393
 
394