Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def split_msg(msg, max_len=250):
- if len(msg) <= max_len:
- return msg
- words = msg.split()
- result = []
- current_line = ""
- for word in words:
- if len(current_line + word) > max_len:
- result.append(current_line)
- current_line = ""
- current_line += word + " "
- result.append(current_line.strip())
- return "\n".join(result)
- MSG = "..." # la reponse de openai
- # split tout les 250 carctere pour etre en plusieurs lignes :
- MSG = split_msg(MSG)
- # affichiage de MSG "....................\n.......................\n..."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement