본문 바로가기

System/Python

python으로 바이너리 파일 업로드 파일 전송으로 만들 것이 있어서 간단하게 만들어 봤어요. Index.php upload.php 더보기
python 2.7.10 버전 설치 파일 Python 2.7 Release Note: A bugfix release, 2.7.10, is currently available. Its use is recommended. Python 2.7 was released on July 3rd, 2010. Python 2.7 is scheduled to be the last major version in the 2.x series before it moves into an extended maintenance period. This release contains many of the features that were first released in Python 3.1. Improvements in this release include:- An ordered.. 더보기
python 문자열 램덤 간단한 예제로 문장에서 단어를 램덤으로 추출하는 소스입니다. 한글 처리와 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 더보기
Python 내장함수 abs abs(x)는 숫자값을 입력값으로 받았을 때, 그 숫자의 절대값을 돌려주는 함수이다. >>> abs(3) 3 >>> abs(-3) 3 >>> abs(1+2j) 2.2360679774997898 >>> 복소수의 절대값은 다음과 같이 구해진다. abs(a + bj) = sqrt (a^2+b^2) all all(x)은 반복가능한(iterable) x가 모두 참인경우 True, 거짓이 하나라도 있을 경우 False를 리턴한다. (※ 반복가능한 x는 for문으로 x값을 출력할 수 있는 형태의 자료형을 의미한다.) 다음의 예를 보자. >>> all([1,2,3]) True 반복가능한 리스트 자료형 [1,2,3]은 모든 항목이 참이므로 True를 리턴한다. >>> all([1,2,3,0]) False 반복가능.. 더보기