mimizukari commited on
Commit
1316877
·
verified ·
1 Parent(s): 1fdeb7b

couple bug fixes on randomization & comma at end of lines

Browse files
Files changed (1) hide show
  1. randumbizer.py +11 -6
randumbizer.py CHANGED
@@ -19,12 +19,17 @@ def read_random_lines(artist_file="artist.txt", sheet_file="Sheet1.txt"):
19
  num_artist_lines = random.randint(1, 4)
20
  selected_artist_lines = random.sample(artist_lines, num_artist_lines)
21
 
22
- result = (
23
- ", ".join(splits[:insertion_index]) + ", "
24
- + ", ".join(line.strip() for line in selected_artist_lines) + ", "
25
- + ", ".join(splits[insertion_index:])
26
- )
27
-
 
 
 
 
 
28
  print(result)
29
  pyperclip.copy(result)
30
  print("\nContent copied to clipboard.")
 
19
  num_artist_lines = random.randint(1, 4)
20
  selected_artist_lines = random.sample(artist_lines, num_artist_lines)
21
 
22
+ pre_artists = ", ".join(splits[:insertion_index])
23
+ artist_section = ", ".join(line.strip() for line in selected_artist_lines)
24
+ post_artists = ", ".join(splits[insertion_index:])
25
+
26
+ if post_artists:
27
+ result = f"{pre_artists}, {artist_section}, {post_artists}".strip()
28
+ else:
29
+ result = f"{pre_artists}, {artist_section}".strip()
30
+
31
+ result = result.rstrip(", ")
32
+
33
  print(result)
34
  pyperclip.copy(result)
35
  print("\nContent copied to clipboard.")