간단한 예제로 문장에서 단어를 램덤으로 추출하는 소스입니다.
한글 처리와 py 파일 실행시 셀 윈도우 pause 기능 포함 되어 있습니다.
Phython 버전은 2.7.10 입니다.
#-*- coding: euc-kr -*-
import random
import os
a = raw_input(u"아무 말이나 입력하시오 : ".encode('euc-kr'))
s = a.split()
b = len(s)
c = 0
print(s)
print(b)
while c <= b :
r = random.randint(0, b-1)
c = c + 1
f = c
print(s[r])
os.system('pause')
'System > Python' 카테고리의 다른 글
python으로 바이너리 파일 업로드 (0) | 2015.11.25 |
---|---|
python 2.7.10 버전 설치 파일 (0) | 2015.11.25 |
Python 내장함수 (0) | 2015.11.17 |