Answer the question
In order to leave comments, you need to log in
Random selection of .ttf files from a directory in Python?
The fact is that I am making a bot for a group whose direction lies in the fonts. Naturally, you need a lot of fonts. I would like to know how to choose 1 random font from the font catalog.
help
Answer the question
In order to leave comments, you need to log in
import os
import random
fonts = os.listdir(‘папка со шрифтами’)
random_font = random.choice(fonts)
import random
fonts = ['1.ttf', '2.ttf', '3.ttf']
font = random.choice(fonts)
from random import choice
fonts = ['file_1.ttf' , 'file_2.ttf' , 'file_3.ttf']
random = choice(fonts)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question