A Byte of Python

A Byte of Python

A Byte of Python Swaroop C H <[email protected]> Translated by Jeongbin Park <[email protected]> 헌정 이 책을 저희를 GNU/Linux, 그리고 오픈 소스의 세계로 이끌어주신 Kalyan Varma43, 그리고 PESIT44의 다른 많은 분들께 바칩니다. 또한 좋은 친구이자 스승이 되어주셨던, 그리운 고 Atul Chitnis45를 기억하며 이 책을 바칩니다. 마지막으로 지금의 인터넷을 탄생시킨 주역들46에게 이 책을 바칩니다. 이 책은 2003년도에 처 음으로 작성되었습니다만, 여전히 많이 읽히고 있습니다. 이것은 바로 이들이 개척해 왔던 지식 의 공유 정신 덕분입니다. 43 http://www.kalyanvarma.net/ 44 http://www.pes.edu/ 45 http://www.nextbigwhat.com/atul-chitnis-obituary-297/ 46 http://www.ibiblio.org/pioneers/index.html ii 차례 ......................................................................................................................... x 1. 책머리 ............................................................................................................ 1 1.1. 서평 ..................................................................................................... 1 1.2. 수업 교재 .............................................................................................. 9 1.3. 권리 및 권한 ........................................................................................ 10 1.4. 책을 읽으세요! ...................................................................................... 10 1.5. 책 구입하기 ......................................................................................... 11 1.6. 내려받기 .............................................................................................. 11 1.7. 번역본 읽기 ......................................................................................... 11 서문 .................................................................................................................. xii 1. 이 책은 누가 읽으면 좋을까요? ................................................................... xii 2. History Lesson ...................................................................................... xii 3. 변경 기록 ............................................................................................... xiii 4. 공식 홈페이지 ......................................................................................... xiv 5. 생각할 것들 ............................................................................................ xiv 2. 소개 ............................................................................................................. 15 2.1. 파이썬의 특징 ....................................................................................... 15 2.2. 파이썬 2 vs 3 ..................................................................................... 17 2.3. 프로그래머들이 말하는 파이썬 ................................................................. 18 3. 설치 ............................................................................................................. 19 3.1. 윈도우 환경에서의 설치 .......................................................................... 19 3.1.1. 명령 프롬프트에서 사용하기 ........................................................... 19 3.1.2. 윈도우 환경에서의 파이썬 실행 ....................................................... 20 3.2. Mac OS X 에서의 설치 ......................................................................... 20 3.3. GNU/Linux 에서의 설치 ........................................................................ 20 3.4. 요약 ................................................................................................... 21 4. 첫 걸음 ......................................................................................................... 22 4.1. 인터프리터 프롬프트에서의 실행 .............................................................. 22 4.2. 편집기 선택하기 .................................................................................... 23 4.3. Light Table ........................................................................................ 24 4.4. Vim ................................................................................................... 25 4.5. Emacs ............................................................................................... 26 4.6. 소스 파일 사용하기 ................................................................................ 26 4.7. 도움 받기 ............................................................................................ 28 4.8. 요약 ................................................................................................... 29 5. 기초 ............................................................................................................. 30 iii A Byte of Python 5.1. 주석 ................................................................................................... 30 5.2. 리터럴 상수 ......................................................................................... 31 5.3. 숫자형 ................................................................................................ 31 5.4. 문자열 ................................................................................................ 32 5.4.1. 작은 따옴표 ................................................................................ 32 5.4.2. 큰 따옴표 ................................................................................... 32 5.4.3. 따옴표 세 개 ............................................................................... 32 5.4.4. 문자열은 수정이 불가 ................................................................... 32 5.4.5. 문자열 포맷팅 ............................................................................. 33 5.4.6. 이스케이프(Escape) 문자 .............................................................. 34 5.4.7. Raw 문자열 ............................................................................... 35 5.5. 변수 ................................................................................................... 36 5.6. 식별자 이름 짓기 .................................................................................. 36 5.7. 자료형 ................................................................................................ 36 5.8. 객체 ................................................................................................... 36 5.9. 파이썬 프로그램 작성하기 ....................................................................... 37 5.10. 예제: 변수와 리터럴 상수 사용하기 ......................................................... 37 5.11. 논리적/물리적 명령행 ........................................................................... 38 5.12. 들여쓰기 ............................................................................................ 39 5.13. 요약 ................................................................................................. 40 6. 연산자와 수식 ................................................................................................ 41 6.1. 연산자 ................................................................................................ 41 6.2. 연산 및 할당 연산자 .............................................................................. 44 6.3. 연산 순서 ............................................................................................ 44 6.4. 연산 순서 변경 ..................................................................................... 45 6.5. 같은 연산 순서를 가질 경우 ..................................................................... 46 6.6. 수식 예제 ............................................................................................ 46 6.7. 요약 ................................................................................................... 47 7. 흐름 제어 ...................................................................................................... 48 7.1. if 문 ................................................................................................. 48 7.2. while 문 ............................................................................................. 50 7.3. for 루프 ............................................................................................ 51 7.4. break 문 ............................................................................................. 53 7.5. continue 문 ...................................................................................... 54 7.6. 요약 ................................................................................................... 55 8. 함수 ............................................................................................................. 56 8.1. 함수와 매개 변수 .................................................................................. 57 8.2. 지역 변수 ............................................................................................ 58 iv A Byte of Python 8.3. global 문 ........................................................................................... 58 8.4. 기본 인수값 ......................................................................................... 59 8.5. 키워드 인수 ......................................................................................... 60 8.6. VarArgs 매개 변수 ............................................................................... 61 8.7. return 문 .......................................................................................... 62 8.8. DocString ........................................................................................... 63 8.9. 요약 ................................................................................................... 64 9. 모듈 ............................................................................................................. 66 9.1. 바이트 컴파일된 .pyc 파일 ..................................................................... 68 9.2. from … import 문 ............................................................................... 68 9.3. 모듈의 __name__ 속성 ........................................................................ 68 9.4. 새로운 모듈 작성하기 ............................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    165 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us