import random
from selenium import webdriver
import time
import clipboard
import pyautogui
file = open('hello.txt', 'r',encoding="utf8")
s = file.readlines()
hi = []
for x in s:
newstr = x.replace("\n", "")
hi.append(newstr)
asap = []
for f in hi:
xxx = f.replace("[", "")
asap.append(xxx)
sampleList = random.sample(asap, 1)
print(sampleList)
hello.txt에 있는 문자들을 리스트로 만들어서 하나를 랜덤으로 출력하는건데
이걸 출력하면 ['반갑습니다!'] 이렇게 출력되는데 >> [' '] << 이거 없애는 방법이 있나요?
댓글 0