피드백
454 |이 책에서 마음에 들지 않거나 이해하기 어렵거나 또는 단순히 잘못된 부분을 지적해줄 여러분과 같은 독자분들의 도움이 필요합니다. 의견이나 제안 사항을 이 책의 저자에게 알려주시거나 이 책의 번역자에게 보내주세요.
455 |한국어 번역판에 대한 의견은 wikibook@wikibook.co.kr로 보내주시기 바랍니다.
456 | 457 | 458 |├── CNAME ├── programs ├── abc.txt ├── function_return.txt ├── oop_init.txt ├── oop_method.txt ├── function1.txt ├── io_pickle.txt ├── for.txt ├── more_list_comprehension.txt ├── function_param.txt ├── more_lambda.txt ├── shoplist.data ├── function_default.txt ├── oop_simplestclass.py ├── for.py ├── mymodule_demo.txt ├── function_local.txt ├── function_global.txt ├── mymodule.py ├── mymodule_demo.py ├── oop_simplestclass.txt ├── exceptions_using_with.py ├── mymodule_demo2.py ├── more_list_comprehension.py ├── poem.txt ├── function_default.py ├── more_lambda.py ├── function1.py ├── function_docstring.txt ├── function_keyword.txt ├── function_varargs.txt ├── io_using_file.txt ├── function_keyword.py ├── break.py ├── module_using_name.py ├── module_using_sys.py ├── exceptions_finally.txt ├── oop_method.py ├── function_local.py ├── ds_str_methods.txt ├── module_using_name.txt ├── backup_ver3.txt ├── continue.txt ├── function_return.py ├── function_global.py ├── exceptions_raise.txt ├── io_unicode.py ├── io_input.txt ├── ds_reference.txt ├── exceptions_handle.py ├── while.txt ├── continue.py ├── oop_init.py ├── stdlib_logging.txt ├── oop_subclass.txt ├── io_input.py ├── ds_using_dict.txt ├── function_param.py ├── function_docstring.py ├── if.txt ├── exceptions_handle.txt ├── ds_using_tuple.txt ├── break.txt ├── module_using_sys.txt ├── backup_ver1.txt ├── function_varargs.py ├── ds_str_methods.py ├── ds_using_list.txt ├── backup_ver2.txt ├── io_pickle.py ├── oop_objvar.txt ├── backup_ver4.txt ├── ds_seq.txt ├── while.py ├── if.py ├── more_decorator.txt ├── io_using_file.py ├── ds_using_tuple.py ├── ds_reference.py ├── exceptions_finally.py ├── ds_using_dict.py ├── ds_using_list.py ├── exceptions_raise.py ├── stdlib_logging.py ├── ds_seq.py ├── backup_ver1.py ├── more_decorator.py ├── backup_ver2.py ├── oop_subclass.py ├── oop_objvar.py ├── backup_ver3.py └── backup_ver4.py ├── img ├── pycharm_run.png ├── pycharm_open.png ├── pycharm_output.png ├── pycharm_hello_open.png ├── terminal_screenshot.png ├── pycharm_new_file_input.png ├── pycharm_new_python_file.png ├── pycharm_create_new_project.png ├── pycharm_command_line_arguments.png └── pycharm_create_new_project_pure_python.png ├── gitbook ├── images │ ├── favicon.ico │ └── apple-touch-icon-precomposed-152.png ├── fonts │ └── fontawesome │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 ├── gitbook-plugin-search │ ├── search.css │ ├── search-engine.js │ ├── search.js │ └── lunr.min.js ├── gitbook-plugin-lunr │ ├── search-lunr.js │ └── lunr.min.js ├── gitbook-plugin-sharing │ └── buttons.js ├── gitbook-plugin-highlight │ └── ebook.css └── gitbook-plugin-fontsettings │ ├── buttons.js │ ├── fontsettings.js │ └── website.css ├── poem.txt ├── INSTALL.md ├── Makefile ├── feedback.html ├── dedication.html ├── translation_howto.html ├── preface.html └── about.html /CNAME: -------------------------------------------------------------------------------- 1 | bop.wikibook.co.kr -------------------------------------------------------------------------------- /programs/abc.txt: -------------------------------------------------------------------------------- 1 | Imagine non-English language here -------------------------------------------------------------------------------- /programs/function_return.txt: -------------------------------------------------------------------------------- 1 | $ python function_return.py 2 | 3 3 | -------------------------------------------------------------------------------- /programs/oop_init.txt: -------------------------------------------------------------------------------- 1 | $ python oop_init.py 2 | Hello, my name is Swaroop 3 | -------------------------------------------------------------------------------- /programs/oop_method.txt: -------------------------------------------------------------------------------- 1 | $ python oop_method.py 2 | Hello, how are you? 3 | -------------------------------------------------------------------------------- /programs/function1.txt: -------------------------------------------------------------------------------- 1 | $ python function1.py 2 | hello world 3 | hello world 4 | -------------------------------------------------------------------------------- /programs/io_pickle.txt: -------------------------------------------------------------------------------- 1 | $ python io_pickle.py 2 | ['apple', 'mango', 'carrot'] 3 | -------------------------------------------------------------------------------- /img/pycharm_run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/img/pycharm_run.png -------------------------------------------------------------------------------- /programs/for.txt: -------------------------------------------------------------------------------- 1 | $ python for.py 2 | 1 3 | 2 4 | 3 5 | 4 6 | The for loop is over 7 | -------------------------------------------------------------------------------- /programs/more_list_comprehension.txt: -------------------------------------------------------------------------------- 1 | $ python more_list_comprehension.py 2 | [6, 8] 3 | -------------------------------------------------------------------------------- /img/pycharm_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/img/pycharm_open.png -------------------------------------------------------------------------------- /programs/function_param.txt: -------------------------------------------------------------------------------- 1 | $ python function_param.py 2 | 4 is maximum 3 | 7 is maximum 4 | -------------------------------------------------------------------------------- /programs/more_lambda.txt: -------------------------------------------------------------------------------- 1 | $ python more_lambda.py 2 | [{'y': 1, 'x': 4}, {'y': 3, 'x': 2}] 3 | -------------------------------------------------------------------------------- /img/pycharm_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/img/pycharm_output.png -------------------------------------------------------------------------------- /programs/shoplist.data: -------------------------------------------------------------------------------- 1 | (lp0 2 | S'apple' 3 | p1 4 | aS'mango' 5 | p2 6 | aS'carrot' 7 | p3 8 | a. -------------------------------------------------------------------------------- /gitbook/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/gitbook/images/favicon.ico -------------------------------------------------------------------------------- /img/pycharm_hello_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/img/pycharm_hello_open.png -------------------------------------------------------------------------------- /programs/function_default.txt: -------------------------------------------------------------------------------- 1 | $ python function_default.py 2 | Hello 3 | WorldWorldWorldWorldWorld 4 | -------------------------------------------------------------------------------- /programs/oop_simplestclass.py: -------------------------------------------------------------------------------- 1 | class Person: 2 | pass # 빈 블록 3 | 4 | p = Person() 5 | print(p) 6 | -------------------------------------------------------------------------------- /img/terminal_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/img/terminal_screenshot.png -------------------------------------------------------------------------------- /programs/for.py: -------------------------------------------------------------------------------- 1 | for i in range(1, 5): 2 | print(i) 3 | else: 4 | print('The for loop is over') 5 | -------------------------------------------------------------------------------- /programs/mymodule_demo.txt: -------------------------------------------------------------------------------- 1 | $ python mymodule_demo.py 2 | Hi, this is mymodule speaking. 3 | Version 0.1 4 | -------------------------------------------------------------------------------- /img/pycharm_new_file_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/img/pycharm_new_file_input.png -------------------------------------------------------------------------------- /img/pycharm_new_python_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/img/pycharm_new_python_file.png -------------------------------------------------------------------------------- /programs/function_local.txt: -------------------------------------------------------------------------------- 1 | $ python function_local.py 2 | x is 50 3 | Changed local x to 2 4 | x is still 50 5 | -------------------------------------------------------------------------------- /img/pycharm_create_new_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/img/pycharm_create_new_project.png -------------------------------------------------------------------------------- /programs/function_global.txt: -------------------------------------------------------------------------------- 1 | $ python function_global.py 2 | x is 50 3 | Changed global x to 2 4 | Value of x is 2 5 | -------------------------------------------------------------------------------- /programs/mymodule.py: -------------------------------------------------------------------------------- 1 | def say_hi(): 2 | print('Hi, this is mymodule speaking.') 3 | 4 | __version__ = '0.1' 5 | -------------------------------------------------------------------------------- /programs/mymodule_demo.py: -------------------------------------------------------------------------------- 1 | import mymodule 2 | 3 | mymodule.say_hi() 4 | print('Version', mymodule.__version__) 5 | -------------------------------------------------------------------------------- /programs/oop_simplestclass.txt: -------------------------------------------------------------------------------- 1 | $ python oop_simplestclass.py 2 | <__main__.Person instance at 0x10171f518> 3 | -------------------------------------------------------------------------------- /poem.txt: -------------------------------------------------------------------------------- 1 | Programming is fun 2 | When the work is done 3 | if you wanna make your work also fun: 4 | use Python! 5 | -------------------------------------------------------------------------------- /programs/exceptions_using_with.py: -------------------------------------------------------------------------------- 1 | with open("poem.txt") as f: 2 | for line in f: 3 | print(line, end='') 4 | -------------------------------------------------------------------------------- /programs/mymodule_demo2.py: -------------------------------------------------------------------------------- 1 | from mymodule import say_hi, __version__ 2 | 3 | say_hi() 4 | print('Version', __version__) 5 | -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | ``` 2 | npm install -g gitbook-cli 3 | gitbook serve 4 | ``` 5 | 6 | See http://toolchain.gitbook.com/ebook.html 7 | -------------------------------------------------------------------------------- /img/pycharm_command_line_arguments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/img/pycharm_command_line_arguments.png -------------------------------------------------------------------------------- /programs/more_list_comprehension.py: -------------------------------------------------------------------------------- 1 | listone = [2, 3, 4] 2 | listtwo = [2*i for i in listone if i > 2] 3 | print(listtwo) 4 | -------------------------------------------------------------------------------- /programs/poem.txt: -------------------------------------------------------------------------------- 1 | Programming is fun 2 | When the work is done 3 | if you wanna make your work also fun: 4 | use Python! 5 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # https://toolchain.gitbook.com/setup.html 2 | setup: 3 | npm install gitbook-cli -g 4 | 5 | serve: 6 | gitbook serve 7 | -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/gitbook/fonts/fontawesome/FontAwesome.otf -------------------------------------------------------------------------------- /programs/function_default.py: -------------------------------------------------------------------------------- 1 | def say(message, times=1): 2 | print(message * times) 3 | 4 | say('Hello') 5 | say('World', 5) 6 | -------------------------------------------------------------------------------- /img/pycharm_create_new_project_pure_python.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/img/pycharm_create_new_project_pure_python.png -------------------------------------------------------------------------------- /programs/more_lambda.py: -------------------------------------------------------------------------------- 1 | points = [{'x': 2, 'y': 3}, 2 | {'x': 4, 'y': 1}] 3 | points.sort(key=lambda i: i['y']) 4 | print(points) 5 | -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/gitbook/fonts/fontawesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/gitbook/fonts/fontawesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/gitbook/fonts/fontawesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /gitbook/images/apple-touch-icon-precomposed-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wikibook/bop/master/gitbook/images/apple-touch-icon-precomposed-152.png -------------------------------------------------------------------------------- /programs/function1.py: -------------------------------------------------------------------------------- 1 | def say_hello(): 2 | # 함수에 속하는 블록 3 | print('hello world') 4 | # 함수 종료 5 | 6 | say_hello() # 함수를 호출 7 | say_hello() # 함수를 다시 호출 8 | -------------------------------------------------------------------------------- /programs/function_docstring.txt: -------------------------------------------------------------------------------- 1 | $ python function_docstring.py 2 | 5 is maximum 3 | Prints the maximum of two numbers. 4 | 5 | The two values must be integers. 6 | -------------------------------------------------------------------------------- /programs/function_keyword.txt: -------------------------------------------------------------------------------- 1 | $ python function_keyword.py 2 | a is 3 and b is 7 and c is 10 3 | a is 25 and b is 5 and c is 24 4 | a is 100 and b is 5 and c is 50 5 | -------------------------------------------------------------------------------- /programs/function_varargs.txt: -------------------------------------------------------------------------------- 1 | $ python function_varargs.py 2 | a 10 3 | single_item 1 4 | single_item 2 5 | single_item 3 6 | Inge 1560 7 | John 2231 8 | Jack 1123 9 | -------------------------------------------------------------------------------- /programs/io_using_file.txt: -------------------------------------------------------------------------------- 1 | $ python3 io_using_file.py 2 | Programming is fun 3 | When the work is done 4 | if you wanna make your work also fun: 5 | use Python! 6 | -------------------------------------------------------------------------------- /programs/function_keyword.py: -------------------------------------------------------------------------------- 1 | def func(a, b=5, c=10): 2 | print('a is', a, 'and b is', b, 'and c is', c) 3 | 4 | func(3, 7) 5 | func(25, c=24) 6 | func(c=50, a=100) 7 | -------------------------------------------------------------------------------- /programs/break.py: -------------------------------------------------------------------------------- 1 | while True: 2 | s = input('Enter something : ') 3 | if s == 'quit': 4 | break 5 | print('Length of the string is', len(s)) 6 | print('Done') 7 | -------------------------------------------------------------------------------- /programs/module_using_name.py: -------------------------------------------------------------------------------- 1 | if __name__ == '__main__': 2 | print('This program is being run by itself') 3 | else: 4 | print('I am being imported from another module') 5 | -------------------------------------------------------------------------------- /programs/module_using_sys.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | print('The command line arguments are:') 4 | for i in sys.argv: 5 | print(i) 6 | 7 | print('\n\nThe PYTHONPATH is', sys.path, '\n') 8 | -------------------------------------------------------------------------------- /programs/exceptions_finally.txt: -------------------------------------------------------------------------------- 1 | $ python exceptions_finally.py 2 | Programming is fun 3 | Press ctrl+c now 4 | ^C!! You cancelled the reading from the file. 5 | (Cleaning up: Closed the file) 6 | -------------------------------------------------------------------------------- /programs/oop_method.py: -------------------------------------------------------------------------------- 1 | class Person: 2 | def say_hi(self): 3 | print('Hello, how are you?') 4 | 5 | p = Person() 6 | p.say_hi() 7 | # 위의 두 줄은 Person('Swaroop').say_hi()라고 작성해도 됩니다 8 | -------------------------------------------------------------------------------- /programs/function_local.py: -------------------------------------------------------------------------------- 1 | x = 50 2 | 3 | 4 | def func(x): 5 | print('x is', x) 6 | x = 2 7 | print('Changed local x to', x) 8 | 9 | 10 | func(x) 11 | print('x is still', x) 12 | -------------------------------------------------------------------------------- /programs/ds_str_methods.txt: -------------------------------------------------------------------------------- 1 | $ python ds_str_methods.py 2 | Yes, the string starts with "Swa" 3 | Yes, it contains the string "a" 4 | Yes, it contains the string "war" 5 | Brazil_*_Russia_*_India_*_China 6 | -------------------------------------------------------------------------------- /programs/module_using_name.txt: -------------------------------------------------------------------------------- 1 | $ python module_using_name.py 2 | This program is being run by itself 3 | 4 | $ python 5 | >>> import module_using_name 6 | I am being imported from another module 7 | >>> 8 | -------------------------------------------------------------------------------- /programs/backup_ver3.txt: -------------------------------------------------------------------------------- 1 | $ python backup_ver3.py 2 | File "backup_ver3.py", line 39 3 | target = today + os.sep + now + '_' + 4 | ^ 5 | SyntaxError: invalid syntax 6 | -------------------------------------------------------------------------------- /programs/continue.txt: -------------------------------------------------------------------------------- 1 | $ python continue.py 2 | Enter something : a 3 | Too small 4 | Enter something : 12 5 | Too small 6 | Enter something : abc 7 | Input is of sufficient length 8 | Enter something : quit 9 | -------------------------------------------------------------------------------- /programs/function_return.py: -------------------------------------------------------------------------------- 1 | def maximum(x, y): 2 | if x > y: 3 | return x 4 | elif x == y: 5 | return 'The numbers are equal' 6 | else: 7 | return y 8 | 9 | print(maximum(2, 3)) 10 | -------------------------------------------------------------------------------- /programs/function_global.py: -------------------------------------------------------------------------------- 1 | x = 50 2 | 3 | 4 | def func(): 5 | global x 6 | 7 | print('x is', x) 8 | x = 2 9 | print('Changed global x to', x) 10 | 11 | 12 | func() 13 | print('Value of x is', x) 14 | -------------------------------------------------------------------------------- /programs/exceptions_raise.txt: -------------------------------------------------------------------------------- 1 | $ python exceptions_raise.py 2 | Enter something --> a 3 | ShortInputException: The input was 1 long, expected at least 3 4 | 5 | $ python exceptions_raise.py 6 | Enter something --> abc 7 | No exception was raised. 8 | -------------------------------------------------------------------------------- /programs/io_unicode.py: -------------------------------------------------------------------------------- 1 | # encoding=utf-8 2 | import io 3 | 4 | f = io.open("abc.txt", "wt", encoding="utf-8") 5 | f.write(u"Imagine non-English language here") 6 | f.close() 7 | 8 | text = io.open("abc.txt", encoding="utf-8").read() 9 | print(text) 10 | -------------------------------------------------------------------------------- /programs/io_input.txt: -------------------------------------------------------------------------------- 1 | $ python3 io_input.py 2 | Enter text: sir 3 | No, it is not a palindrome 4 | 5 | $ python3 io_input.py 6 | Enter text: madam 7 | Yes, it is a palindrome 8 | 9 | $ python3 io_input.py 10 | Enter text: racecar 11 | Yes, it is a palindrome 12 | -------------------------------------------------------------------------------- /programs/ds_reference.txt: -------------------------------------------------------------------------------- 1 | $ python ds_reference.py 2 | Simple Assignment 3 | shoplist is ['mango', 'carrot', 'banana'] 4 | mylist is ['mango', 'carrot', 'banana'] 5 | Copy by making a full slice 6 | shoplist is ['mango', 'carrot', 'banana'] 7 | mylist is ['carrot', 'banana'] 8 | -------------------------------------------------------------------------------- /programs/exceptions_handle.py: -------------------------------------------------------------------------------- 1 | try: 2 | text = input('Enter something --> ') 3 | except EOFError: 4 | print('Why did you do an EOF on me?') 5 | except KeyboardInterrupt: 6 | print('You cancelled the operation.') 7 | else: 8 | print('You entered {}'.format(text)) 9 | -------------------------------------------------------------------------------- /programs/while.txt: -------------------------------------------------------------------------------- 1 | $ python while.py 2 | Enter an integer : 50 3 | No, it is a little lower than that. 4 | Enter an integer : 22 5 | No, it is a little higher than that. 6 | Enter an integer : 23 7 | Congratulations, you guessed it. 8 | The while loop is over. 9 | Done 10 | -------------------------------------------------------------------------------- /programs/continue.py: -------------------------------------------------------------------------------- 1 | while True: 2 | s = input('Enter something : ') 3 | if s == 'quit': 4 | break 5 | if len(s) < 3: 6 | print('Too small') 7 | continue 8 | print('Input is of sufficient length') 9 | # 이곳에서 다른 처리 내용을 수행합니다... 10 | -------------------------------------------------------------------------------- /programs/oop_init.py: -------------------------------------------------------------------------------- 1 | class Person: 2 | def __init__(self, name): 3 | self.name = name 4 | 5 | def say_hi(self): 6 | print('Hello, my name is', self.name) 7 | 8 | p = Person('Swaroop') 9 | p.say_hi() 10 | # 위의 두 줄은 Person('Swaroop').say_hi()라고 작성해도 됩니다 11 | -------------------------------------------------------------------------------- /programs/stdlib_logging.txt: -------------------------------------------------------------------------------- 1 | $ python stdlib_logging.py 2 | Logging to /Users/swa/test.log 3 | 4 | $ cat /Users/swa/test.log 5 | 2014-03-29 09:27:36,660 : DEBUG : Start of the program 6 | 2014-03-29 09:27:36,660 : INFO : Doing something 7 | 2014-03-29 09:27:36,660 : WARNING : Dying now 8 | -------------------------------------------------------------------------------- /programs/oop_subclass.txt: -------------------------------------------------------------------------------- 1 | $ python oop_subclass.py 2 | (Initialized SchoolMember: Mrs. Shrividya) 3 | (Initialized Teacher: Mrs. Shrividya) 4 | (Initialized SchoolMember: Swaroop) 5 | (Initialized Student: Swaroop) 6 | 7 | Name:"Mrs. Shrividya" Age:"40" Salary: "30000" 8 | Name:"Swaroop" Age:"25" Marks: "75" 9 | -------------------------------------------------------------------------------- /programs/io_input.py: -------------------------------------------------------------------------------- 1 | def reverse(text): 2 | return text[::-1] 3 | 4 | 5 | def is_palindrome(text): 6 | return text == reverse(text) 7 | 8 | 9 | something = input("Enter text: ") 10 | if is_palindrome(something): 11 | print("Yes, it is a palindrome") 12 | else: 13 | print("No, it is not a palindrome") 14 | -------------------------------------------------------------------------------- /programs/ds_using_dict.txt: -------------------------------------------------------------------------------- 1 | $ python ds_using_dict.py 2 | Swaroop's address is swaroop@swaroopch.com 3 | 4 | There are 3 contacts in the address-book 5 | 6 | Contact Swaroop at swaroop@swaroopch.com 7 | Contact Matsumoto at matz@ruby-lang.org 8 | Contact Larry at larry@wall.org 9 | 10 | Guido's address is guido@python.org 11 | -------------------------------------------------------------------------------- /programs/function_param.py: -------------------------------------------------------------------------------- 1 | def print_max(a, b): 2 | if a > b: 3 | print(a, 'is maximum') 4 | elif a == b: 5 | print(a, 'is equal to', b) 6 | else: 7 | print(b, 'is maximum') 8 | 9 | # 리터럴 값을 직접 전달 10 | print_max(3, 4) 11 | 12 | x = 5 13 | y = 7 14 | 15 | # 변수를 인수로 전달 16 | print_max(x, y) 17 | -------------------------------------------------------------------------------- /programs/function_docstring.py: -------------------------------------------------------------------------------- 1 | def print_max(x, y): 2 | '''두 숫자 중 최댓값을 출력합니다. 3 | 4 | 두 숫자는 정수여야 합니다.''' 5 | # 가능할 경우 정수로 변환 6 | x = int(x) 7 | y = int(y) 8 | 9 | if x > y: 10 | print(x, 'is maximum') 11 | else: 12 | print(y, 'is maximum') 13 | 14 | print_max(3, 5) 15 | print(print_max.__doc__) 16 | -------------------------------------------------------------------------------- /programs/if.txt: -------------------------------------------------------------------------------- 1 | $ python if.py 2 | Enter an integer : 50 3 | No, it is a little lower than that 4 | Done 5 | 6 | $ python if.py 7 | Enter an integer : 22 8 | No, it is a little higher than that 9 | Done 10 | 11 | $ python if.py 12 | Enter an integer : 23 13 | Congratulations, you guessed it. 14 | (but you do not win any prizes!) 15 | Done 16 | -------------------------------------------------------------------------------- /programs/exceptions_handle.txt: -------------------------------------------------------------------------------- 1 | # Press ctrl + d 2 | $ python exceptions_handle.py 3 | Enter something --> Why did you do an EOF on me? 4 | 5 | # Press ctrl + c 6 | $ python exceptions_handle.py 7 | Enter something --> ^CYou cancelled the operation. 8 | 9 | $ python exceptions_handle.py 10 | Enter something --> No exceptions 11 | You entered No exceptions 12 | -------------------------------------------------------------------------------- /programs/ds_using_tuple.txt: -------------------------------------------------------------------------------- 1 | $ python ds_using_tuple.py 2 | Number of animals in the zoo is 3 3 | Number of cages in the new zoo is 3 4 | All animals in new zoo are ('monkey', 'camel', ('python', 'elephant', 'penguin')) 5 | Animals brought from old zoo are ('python', 'elephant', 'penguin') 6 | Last animal brought from old zoo is penguin 7 | Number of animals in the new zoo is 5 8 | -------------------------------------------------------------------------------- /programs/break.txt: -------------------------------------------------------------------------------- 1 | $ python break.py 2 | Enter something : Programming is fun 3 | Length of the string is 18 4 | Enter something : When the work is done 5 | Length of the string is 21 6 | Enter something : if you wanna make your work also fun: 7 | Length of the string is 37 8 | Enter something : use Python! 9 | Length of the string is 11 10 | Enter something : quit 11 | Done 12 | -------------------------------------------------------------------------------- /programs/module_using_sys.txt: -------------------------------------------------------------------------------- 1 | $ python module_using_sys.py we are arguments # each arg is separated by white space 2 | The command line arguments are: 3 | module_using_sys.py 4 | we 5 | are 6 | arguments 7 | 8 | 9 | The PYTHONPATH is ['/tmp/py', 10 | # 이곳에 여러 개의 항목이 표시되며, 나머지 항목은 생략합니다 11 | '/Library/Python/2.7/site-packages', 12 | '/usr/local/lib/python2.7/site-packages'] 13 | -------------------------------------------------------------------------------- /programs/backup_ver1.txt: -------------------------------------------------------------------------------- 1 | $ python backup_ver1.py 2 | Zip command is: 3 | zip -r /Users/swa/backup/20140328084844.zip /Users/swa/notes 4 | Running: 5 | adding: Users/swa/notes/ (stored 0%) 6 | adding: Users/swa/notes/blah1.txt (stored 0%) 7 | adding: Users/swa/notes/blah2.txt (stored 0%) 8 | adding: Users/swa/notes/blah3.txt (stored 0%) 9 | Successful backup to /Users/swa/backup/20140328084844.zip 10 | -------------------------------------------------------------------------------- /programs/function_varargs.py: -------------------------------------------------------------------------------- 1 | def total(a=5, *numbers, **phonebook): 2 | print('a', a) 3 | 4 | # 튜플의 모든 항목을 순회합니다 5 | for single_item in numbers: 6 | print('single_item', single_item) 7 | 8 | # 딕셔너리의 모든 항목을 순회합니다 9 | for first_part, second_part in phonebook.items(): 10 | print(first_part,second_part) 11 | 12 | total(10,1,2,3,Jack=1123,John=2231,Inge=1560) 13 | -------------------------------------------------------------------------------- /programs/ds_str_methods.py: -------------------------------------------------------------------------------- 1 | # 다음은 문자열 객체입니다 2 | name = 'Swaroop' 3 | 4 | if name.startswith('Swa'): 5 | print('Yes, the string starts with "Swa"') 6 | 7 | if 'a' in name: 8 | print('Yes, it contains the string "a"') 9 | 10 | if name.find('war') != -1: 11 | print('Yes, it contains the string "war"') 12 | 13 | delimiter = '_*_' 14 | mylist = ['Brazil', 'Russia', 'India', 'China'] 15 | print(delimiter.join(mylist)) 16 | -------------------------------------------------------------------------------- /programs/ds_using_list.txt: -------------------------------------------------------------------------------- 1 | $ python ds_using_list.py 2 | I have 4 items to purchase. 3 | These items are: apple mango carrot banana 4 | I also have to buy rice. 5 | My shopping list is now ['apple', 'mango', 'carrot', 'banana', 'rice'] 6 | I will sort my list now 7 | Sorted shopping list is ['apple', 'banana', 'carrot', 'mango', 'rice'] 8 | The first item I will buy is apple 9 | I bought the apple 10 | My shopping list is now ['banana', 'carrot', 'mango', 'rice'] 11 | -------------------------------------------------------------------------------- /programs/backup_ver2.txt: -------------------------------------------------------------------------------- 1 | $ python backup_ver2.py 2 | Successfully created directory /Users/swa/backup/20140329 3 | Zip command is: 4 | zip -r /Users/swa/backup/20140329/073201.zip /Users/swa/notes 5 | Running: 6 | adding: Users/swa/notes/ (stored 0%) 7 | adding: Users/swa/notes/blah1.txt (stored 0%) 8 | adding: Users/swa/notes/blah2.txt (stored 0%) 9 | adding: Users/swa/notes/blah3.txt (stored 0%) 10 | Successful backup to /Users/swa/backup/20140329/073201.zip 11 | -------------------------------------------------------------------------------- /programs/io_pickle.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | 3 | # 객체를 저장할 파일의 이름 4 | shoplistfile = 'shoplist.data' 5 | # 구입할 품목의 리스트 6 | shoplist = ['apple', 'mango', 'carrot'] 7 | 8 | # 파일에 씁니다 9 | f = open(shoplistfile, 'wb') 10 | # 객체를 파일에 저장합니다 11 | pickle.dump(shoplist, f) 12 | f.close() 13 | 14 | # shoplist 변수를 삭제합니다 15 | del shoplist 16 | 17 | # 저장장치에서 읽어옵니다 18 | f = open(shoplistfile, 'rb') 19 | # 파일에서 객체를 불러옵니다 20 | storedlist = pickle.load(f) 21 | print(storedlist) 22 | f.close() 23 | -------------------------------------------------------------------------------- /programs/oop_objvar.txt: -------------------------------------------------------------------------------- 1 | $ python oop_objvar.py 2 | (Initializing R2-D2) 3 | Greetings, my masters call me R2-D2. 4 | We have 1 robots. 5 | (Initializing C-3PO) 6 | Greetings, my masters call me C-3PO. 7 | We have 2 robots. 8 | 9 | Robots can do some work here. 10 | 11 | Robots have finished their work. So let's destroy them. 12 | R2-D2 is being destroyed! 13 | There are still 1 robots working. 14 | C-3PO is being destroyed! 15 | C-3PO was the last one. 16 | We have 0 robots. 17 | -------------------------------------------------------------------------------- /programs/backup_ver4.txt: -------------------------------------------------------------------------------- 1 | $ python backup_ver4.py 2 | Enter a comment --> added new examples 3 | Zip command is: 4 | zip -r /Users/swa/backup/20140329/074122_added_new_examples.zip /Users/swa/notes 5 | Running: 6 | adding: Users/swa/notes/ (stored 0%) 7 | adding: Users/swa/notes/blah1.txt (stored 0%) 8 | adding: Users/swa/notes/blah2.txt (stored 0%) 9 | adding: Users/swa/notes/blah3.txt (stored 0%) 10 | Successful backup to /Users/swa/backup/20140329/074122_added_new_examples.zip 11 | -------------------------------------------------------------------------------- /programs/ds_seq.txt: -------------------------------------------------------------------------------- 1 | $ python ds_seq.py 2 | Item 0 is apple 3 | Item 1 is mango 4 | Item 2 is carrot 5 | Item 3 is banana 6 | Item -1 is banana 7 | Item -2 is carrot 8 | Character 0 is s 9 | Item 1 to 3 is ['mango', 'carrot'] 10 | Item 2 to end is ['carrot', 'banana'] 11 | Item 1 to -1 is ['mango', 'carrot'] 12 | Item start to end is ['apple', 'mango', 'carrot', 'banana'] 13 | characters 1 to 3 is wa 14 | characters 2 to end is aroop 15 | characters 1 to -1 is waroo 16 | characters start to end is swaroop 17 | -------------------------------------------------------------------------------- /programs/while.py: -------------------------------------------------------------------------------- 1 | number = 23 2 | running = True 3 | 4 | while running: 5 | guess = int(input('Enter an integer : ')) 6 | 7 | if guess == number: 8 | print('Congratulations, you guessed it.') 9 | # 다음 코드는 while 문을 중단하게 합니다 10 | running = False 11 | elif guess < number: 12 | print('No, it is a little higher than that.') 13 | else: 14 | print('No, it is a little lower than that.') 15 | else: 16 | print('The while loop is over.') 17 | # 이곳에서 하고 싶은 작업을 합니다 18 | 19 | print('Done') 20 | -------------------------------------------------------------------------------- /programs/if.py: -------------------------------------------------------------------------------- 1 | number = 23 2 | guess = int(input('Enter an integer : ')) 3 | 4 | if guess == number: 5 | # 이곳에서 새 블록을 시작 6 | print('Congratulations, you guessed it.') 7 | print('(but you do not win any prizes!)') 8 | # 이곳에서 새 블록을 종료 9 | elif guess < number: 10 | # 또 다른 블록 11 | print('No, it is a little higher than that') 12 | # 블록 안에서 원하는 무엇이든 할 수 있습니다... 13 | else: 14 | print('No, it is a little lower than that') 15 | # 여기에 도달했다면 분명 guessed > number일 것입니다 16 | 17 | print('Done') 18 | # if 문의 실행이 끝나면 이 마지막 문장이 항상 실행됩니다 19 | -------------------------------------------------------------------------------- /programs/more_decorator.txt: -------------------------------------------------------------------------------- 1 | $ python more_decorator.py 2 | Write to a database or make a network call or etc. 3 | This will be automatically retried if exception is thrown. 4 | ERROR:retry:Attempt 1/5 failed : (('Some bad value',), {}) 5 | Traceback (most recent call last): 6 | File "more_decorator.py", line 14, in wrapper_function 7 | return f(*args, **kwargs) 8 | File "more_decorator.py", line 39, in save_to_database 9 | raise ValueError(arg) 10 | ValueError: Some bad value 11 | Write to a database or make a network call or etc. 12 | This will be automatically retried if exception is thrown. 13 | -------------------------------------------------------------------------------- /programs/io_using_file.py: -------------------------------------------------------------------------------- 1 | poem = '''\ 2 | Programming is fun 3 | When the work is done 4 | if you wanna make your work also fun: 5 | use Python! 6 | ''' 7 | 8 | # 쓰기('w'riting) 모드로 엽니다 9 | f = open('poem.txt', 'w') 10 | # 텍스트를 파일에 씁니다 11 | f.write(poem) 12 | # 파일을 닫습니다 13 | f.close() 14 | 15 | # 모드를 지정하지 않으면 기본적으로 16 | # 읽기('r'ead) 모드로 가정합니다 17 | f = open('poem.txt') 18 | while True: 19 | line = f.readline() 20 | # 길이가 0이면 EOF을 나타냅니다 21 | if len(line) == 0: 22 | break 23 | # 파일에서 읽어오고 있으므로 24 | # `line`의 각 줄 끝에는 25 | # 개행 문자가 있습니다 26 | print(line, end='') 27 | # 파일을 닫습니다 28 | f.close() 29 | -------------------------------------------------------------------------------- /programs/ds_using_tuple.py: -------------------------------------------------------------------------------- 1 | # 괄호를 반드시 써야 하는 것이 아니더라도 2 | # 항상 괄호를 써서 튜플의 시작과 끝을 3 | # 나타내는 방법을 권장합니다. 4 | # 명시적인 것이 암묵적인 것보다 낫습니다. 5 | zoo = ('python', 'elephant', 'penguin') 6 | print('Number of animals in the zoo is', len(zoo)) 7 | 8 | new_zoo = 'monkey', 'camel', zoo # parentheses not required but are a good idea 9 | print('Number of cages in the new zoo is', len(new_zoo)) 10 | print('All animals in new zoo are', new_zoo) 11 | print('Animals brought from old zoo are', new_zoo[2]) 12 | print('Last animal brought from old zoo is', new_zoo[2][2]) 13 | print('Number of animals in the new zoo is', 14 | len(new_zoo)-1+len(new_zoo[2])) 15 | -------------------------------------------------------------------------------- /programs/ds_reference.py: -------------------------------------------------------------------------------- 1 | print('Simple Assignment') 2 | shoplist = ['apple', 'mango', 'carrot', 'banana'] 3 | # mylist는 단지 같은 객체를 가리키는 또 다른 이름일 뿐입니다! 4 | mylist = shoplist 5 | 6 | # 첫 번째 품목을 구입했으므로 리스트에서 제거합니다 7 | del shoplist[0] 8 | 9 | print('shoplist is', shoplist) 10 | print('mylist is', mylist) 11 | # shoplist와 mylist 모두 'apple'이 없는 같은 리스트를 출력한다는 점에 12 | # 유의합니다. 이것은 두 리스트가 같은 객체를 가리킨다는 사실을 보여줍니다. 13 | 14 | print('Copy by making a full slice') 15 | # 전체 슬라이스를 통해 사본을 만듭니다 16 | mylist = shoplist[:] 17 | # 첫 번째 항목 제거 18 | del mylist[0] 19 | 20 | print('shoplist is', shoplist) 21 | print('mylist is', mylist) 22 | # 이제 두 리스트가 다르다는 데 주의합니다 23 | -------------------------------------------------------------------------------- /programs/exceptions_finally.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import time 3 | 4 | f = None 5 | try: 6 | f = open("poem.txt") 7 | # 일반적인 파일 읽기 코드 8 | while True: 9 | line = f.readline() 10 | if len(line) == 0: 11 | break 12 | print(line, end='') 13 | sys.stdout.flush() 14 | print("Press ctrl+c now") 15 | # 잠시 동안 실행되게 합니다 16 | time.sleep(2) 17 | except IOError: 18 | print("Could not find file poem.txt") 19 | except KeyboardInterrupt: 20 | print("!! You cancelled the reading from the file.") 21 | finally: 22 | if f: 23 | f.close() 24 | print("(Cleaning up: Closed the file)") 25 | -------------------------------------------------------------------------------- /programs/ds_using_dict.py: -------------------------------------------------------------------------------- 1 | # 'ab'는 주소록('a'ddress 'b'ook)의 약자입니다 2 | 3 | ab = { 4 | 'Swaroop': 'swaroop@swaroopch.com', 5 | 'Larry': 'larry@wall.org', 6 | 'Matsumoto': 'matz@ruby-lang.org', 7 | 'Spammer': 'spammer@hotmail.com' 8 | } 9 | 10 | print("Swaroop's address is", ab['Swaroop']) 11 | 12 | # 키-값 쌍을 삭제 13 | del ab['Spammer'] 14 | 15 | print('\nThere are {} contacts in the address-book\n'.format(len(ab))) 16 | 17 | for name, address in ab.items(): 18 | print('Contact {} at {}'.format(name, address)) 19 | 20 | # 키-값 쌍을 추가 21 | ab['Guido'] = 'guido@python.org' 22 | 23 | if 'Guido' in ab: 24 | print("\nGuido's address is", ab['Guido']) 25 | -------------------------------------------------------------------------------- /programs/ds_using_list.py: -------------------------------------------------------------------------------- 1 | # 다음은 쇼핑 목록입니다 2 | shoplist = ['apple', 'mango', 'carrot', 'banana'] 3 | 4 | print('I have', len(shoplist), 'items to purchase.') 5 | 6 | print('These items are:', end=' ') 7 | for item in shoplist: 8 | print(item, end=' ') 9 | 10 | print('\nI also have to buy rice.') 11 | shoplist.append('rice') 12 | print('My shopping list is now', shoplist) 13 | 14 | print('I will sort my list now') 15 | shoplist.sort() 16 | print('Sorted shopping list is', shoplist) 17 | 18 | print('The first item I will buy is', shoplist[0]) 19 | olditem = shoplist[0] 20 | del shoplist[0] 21 | print('I bought the', olditem) 22 | print('My shopping list is now', shoplist) 23 | -------------------------------------------------------------------------------- /programs/exceptions_raise.py: -------------------------------------------------------------------------------- 1 | class ShortInputException(Exception): 2 | '''사용자 정의 예외 클래스''' 3 | def __init__(self, length, atleast): 4 | Exception.__init__(self) 5 | self.length = length 6 | self.atleast = atleast 7 | 8 | try: 9 | text = input('Enter something --> ') 10 | if len(text) < 3: 11 | raise ShortInputException(len(text), 3) 12 | # 이곳에서 다른 작업을 계속할 수 있습니다 13 | except EOFError: 14 | print('Why did you do an EOF on me?') 15 | except ShortInputException as ex: 16 | print(('ShortInputException: The input was ' + 17 | '{0} long, expected at least {1}') 18 | .format(ex.length, ex.atleast)) 19 | else: 20 | print('No exception was raised.') 21 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-search/search.css: -------------------------------------------------------------------------------- 1 | .book .book-summary .book-search { 2 | padding: 6px; 3 | background: transparent; 4 | position: absolute; 5 | top: -50px; 6 | left: 0px; 7 | right: 0px; 8 | transition: top 0.5s ease; 9 | } 10 | .book .book-summary .book-search input, 11 | .book .book-summary .book-search input:focus, 12 | .book .book-summary .book-search input:hover { 13 | width: 100%; 14 | background: transparent; 15 | border: 1px solid transparent; 16 | box-shadow: none; 17 | outline: none; 18 | line-height: 22px; 19 | padding: 7px 4px; 20 | color: inherit; 21 | } 22 | .book.with-search .book-summary .book-search { 23 | top: 0px; 24 | } 25 | .book.with-search .book-summary ul.summary { 26 | top: 50px; 27 | } 28 | -------------------------------------------------------------------------------- /programs/stdlib_logging.py: -------------------------------------------------------------------------------- 1 | import os 2 | import platform 3 | import logging 4 | 5 | if platform.platform().startswith('Windows'): 6 | logging_file = os.path.join(os.getenv('HOMEDRIVE'), 7 | os.getenv('HOMEPATH'), 8 | 'test.log') 9 | else: 10 | logging_file = os.path.join(os.getenv('HOME'), 11 | 'test.log') 12 | 13 | print("Logging to", logging_file) 14 | 15 | logging.basicConfig( 16 | level=logging.DEBUG, 17 | format='%(asctime)s : %(levelname)s : %(message)s', 18 | filename=logging_file, 19 | filemode='w', 20 | ) 21 | 22 | logging.debug("Start of the program") 23 | logging.info("Doing something") 24 | logging.warning("Dying now") 25 | -------------------------------------------------------------------------------- /programs/ds_seq.py: -------------------------------------------------------------------------------- 1 | shoplist = ['apple', 'mango', 'carrot', 'banana'] 2 | name = 'swaroop' 3 | 4 | # 인덱싱 또는 첨자 연산 5 | print('Item 0 is', shoplist[0]) 6 | print('Item 1 is', shoplist[1]) 7 | print('Item 2 is', shoplist[2]) 8 | print('Item 3 is', shoplist[3]) 9 | print('Item -1 is', shoplist[-1]) 10 | print('Item -2 is', shoplist[-2]) 11 | print('Character 0 is', name[0]) 12 | 13 | # 리스트 슬라이싱 14 | print('Item 1 to 3 is', shoplist[1:3]) 15 | print('Item 2 to end is', shoplist[2:]) 16 | print('Item 1 to -1 is', shoplist[1:-1]) 17 | print('Item start to end is', shoplist[:]) 18 | 19 | # 문자열 슬라이싱 20 | print('characters 1 to 3 is', name[1:3]) 21 | print('characters 2 to end is', name[2:]) 22 | print('characters 1 to -1 is', name[1:-1]) 23 | print('characters start to end is', name[:]) 24 | -------------------------------------------------------------------------------- /programs/backup_ver1.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | 4 | # 1. 백업할 파일과 디렉터리는 리스트에 지정됩니다. 5 | # 윈도우에서의 예: 6 | # source = ['"C:\\My Documents"'] 7 | # macOS와 리눅스에서의 예: 8 | source = ['/Users/swa/notes'] 9 | # 이름에 공백이 포함된 문자열 안에서는 큰따옴표를 써야 합니다. 10 | # [r'C:\My Documents']와 같이 원시 문자열을 사용해도 됩니다. 11 | 12 | # 2. 백업 파일은 메인 백업 디렉터리에 저장해야 합니다. 13 | # 윈도우에서의 예: 14 | # target_dir = 'E:\\Backup' 15 | # macOS와 리눅스에서의 예: 16 | target_dir = '/Users/swa/backup' 17 | # 사용할 폴더로 이 값을 변경하는 것을 잊지 마세요. 18 | 19 | # 3. 파일은 zip 파일로 백업됩니다. 20 | # 4. zip 파일의 이름은 현재 날짜와 시간으로 구성됩니다. 21 | target = target_dir + os.sep + \ 22 | time.strftime('%Y%m%d%H%M%S') + '.zip' 23 | 24 | # 대상 디렉터리가 존재하지 않는 경우 생성합니다 25 | if not os.path.exists(target_dir): 26 | os.mkdir(target_dir) # 디렉터리를 생성 27 | 28 | # 5. zip 명령어를 사용해 파일을 zip 파일에 추가합니다 29 | zip_command = 'zip -r {0} {1}'.format(target, 30 | ' '.join(source)) 31 | 32 | # 백업 실행 33 | print('Zip command is:') 34 | print(zip_command) 35 | print('Running:') 36 | if os.system(zip_command) == 0: 37 | print('Successful backup to', target) 38 | else: 39 | print('Backup FAILED') 40 | -------------------------------------------------------------------------------- /programs/more_decorator.py: -------------------------------------------------------------------------------- 1 | from time import sleep 2 | from functools import wraps 3 | import logging 4 | logging.basicConfig() 5 | log = logging.getLogger("retry") 6 | 7 | 8 | def retry(f): 9 | @wraps(f) 10 | def wrapper_function(*args, **kwargs): 11 | MAX_ATTEMPTS = 5 12 | for attempt in range(1, MAX_ATTEMPTS + 1): 13 | try: 14 | return f(*args, **kwargs) 15 | except Exception: 16 | log.exception("Attempt %s/%s failed : %s", 17 | attempt, 18 | MAX_ATTEMPTS, 19 | (args, kwargs)) 20 | sleep(10 * attempt) 21 | log.critical("All %s attempts failed : %s", 22 | MAX_ATTEMPTS, 23 | (args, kwargs)) 24 | return wrapper_function 25 | 26 | 27 | counter = 0 28 | 29 | 30 | @retry 31 | def save_to_database(arg): 32 | print("Write to a database or make a network call or etc.") 33 | print("This will be automatically retried if exception is thrown.") 34 | global counter 35 | counter += 1 36 | # 처음으로 호출했을 때는 예외를 발생시키고 37 | # 두 번째 호출(즉, 재시도)부터는 문제 없이 동작합니다 38 | if counter < 2: 39 | raise ValueError(arg) 40 | 41 | 42 | if __name__ == '__main__': 43 | save_to_database("Some bad value") 44 | -------------------------------------------------------------------------------- /programs/backup_ver2.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | 4 | # 1. 백업할 파일과 디렉터리는 리스트에 지정됩니다. 5 | # 윈도우에서의 예: 6 | # source = ['"C:\\My Documents"', 'C:\\Code'] 7 | # macOS와 리눅스에서의 예: 8 | source = ['/Users/swa/notes'] 9 | # 이름에 공백이 포함된 문자열 안에서는 큰따옴표를 써야 합니다. 10 | 11 | # 2. 백업 파일은 메인 백업 디렉터리에 저장해야 합니다. 12 | # 윈도우에서의 예: 13 | # target_dir = 'E:\\Backup' 14 | # macOS와 리눅스에서의 예: 15 | target_dir = '/Users/swa/backup' 16 | # 사용할 폴더로 이 값을 변경하는 것을 잊지 마세요. 17 | 18 | # 대상 디렉터리가 존재하지 않는 경우 생성합니다 19 | if not os.path.exists(target_dir): 20 | os.mkdir(target_dir) # make directory 21 | 22 | # 3. 파일은 zip 파일로 백업됩니다. 23 | # 4. 현재 날짜를 메인 디렉터리 내의 하위 디렉터리명으로 사용합니다. 24 | today = target_dir + os.sep + time.strftime('%Y%m%d') 25 | # 현재 시간을 zip 파일의 이름으로 사용합니다. 26 | now = time.strftime('%H%M%S') 27 | 28 | # zip 파일의 이름 29 | target = today + os.sep + now + '.zip' 30 | 31 | # 하위 디렉터리가 존재하지 않으면 생성합니다 32 | if not os.path.exists(today): 33 | os.mkdir(today) 34 | print('Successfully created directory', today) 35 | 36 | # 5. zip 명령어를 사용해 파일을 zip 파일에 추가합니다 37 | zip_command = 'zip -r {0} {1}'.format(target, 38 | ' '.join(source)) 39 | 40 | # 백업 실행 41 | print('Zip command is:') 42 | print(zip_command) 43 | print('Running:') 44 | if os.system(zip_command) == 0: 45 | print('Successful backup to', target) 46 | else: 47 | print('Backup FAILED') 48 | -------------------------------------------------------------------------------- /programs/oop_subclass.py: -------------------------------------------------------------------------------- 1 | class SchoolMember: 2 | '''학교 구성원을 나타냅니다.''' 3 | def __init__(self, name, age): 4 | self.name = name 5 | self.age = age 6 | print('(Initialized SchoolMember: {})'.format(self.name)) 7 | 8 | def tell(self): 9 | '''세부사항을 출력합니다.''' 10 | print('Name:"{}" Age:"{}"'.format(self.name, self.age), end=" ") 11 | 12 | 13 | class Teacher(SchoolMember): 14 | '''교사를 나타냅니다.''' 15 | def __init__(self, name, age, salary): 16 | SchoolMember.__init__(self, name, age) 17 | self.salary = salary 18 | print('(Initialized Teacher: {})'.format(self.name)) 19 | 20 | def tell(self): 21 | SchoolMember.tell(self) 22 | print('Salary: "{:d}"'.format(self.salary)) 23 | 24 | 25 | class Student(SchoolMember): 26 | '''학생을 나타냅니다.''' 27 | def __init__(self, name, age, marks): 28 | SchoolMember.__init__(self, name, age) 29 | self.marks = marks 30 | print('(Initialized Student: {})'.format(self.name)) 31 | 32 | def tell(self): 33 | SchoolMember.tell(self) 34 | print('Marks: "{:d}"'.format(self.marks)) 35 | 36 | t = Teacher('Mrs. Shrividya', 40, 30000) 37 | s = Student('Swaroop', 25, 75) 38 | 39 | # 빈 줄을 출력합니다 40 | print() 41 | 42 | members = [t, s] 43 | for member in members: 44 | # Teacher와 Student에 대해 모두 동작합니다 45 | member.tell() 46 | -------------------------------------------------------------------------------- /programs/oop_objvar.py: -------------------------------------------------------------------------------- 1 | class Robot: 2 | """이름을 가진 로봇을 나타냅니다.""" 3 | 4 | # 로봇의 수를 세는 클래스 변수 5 | population = 0 6 | 7 | def __init__(self, name): 8 | """데이터를 초기화합니다.""" 9 | self.name = name 10 | print("(Initializing {})".format(self.name)) 11 | 12 | # 이 로봇이 생성되면 로봇 수에 더해집니다. 13 | Robot.population += 1 14 | 15 | def die(self): 16 | """저는 죽어가고 있습니다.""" 17 | print("{} is being destroyed!".format(self.name)) 18 | 19 | Robot.population -= 1 20 | 21 | if Robot.population == 0: 22 | print("{} was the last one.".format(self.name)) 23 | else: 24 | print("There are still {:d} robots working.".format( 25 | Robot.population)) 26 | 27 | def say_hi(self): 28 | """로봇이 인사합니다. 29 | 30 | 로봇은 인사할 수 있습니다.""" 31 | print("Greetings, my masters call me {}.".format(self.name)) 32 | 33 | @classmethod 34 | def how_many(cls): 35 | """현재 로봇 수를 출력합니다.""" 36 | print("We have {:d} robots.".format(cls.population)) 37 | 38 | 39 | droid1 = Robot("R2-D2") 40 | droid1.say_hi() 41 | Robot.how_many() 42 | 43 | droid2 = Robot("C-3PO") 44 | droid2.say_hi() 45 | Robot.how_many() 46 | 47 | print("\nRobots can do some work here.\n") 48 | 49 | print("Robots have finished their work. So let's destroy them.") 50 | droid1.die() 51 | droid2.die() 52 | 53 | Robot.how_many() 54 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-search/search-engine.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | // Global search objects 6 | var engine = null; 7 | var initialized = false; 8 | 9 | // Set a new search engine 10 | function setEngine(Engine, config) { 11 | initialized = false; 12 | engine = new Engine(config); 13 | 14 | init(config); 15 | } 16 | 17 | // Initialize search engine with config 18 | function init(config) { 19 | if (!engine) throw new Error('No engine set for research. Set an engine using gitbook.research.setEngine(Engine).'); 20 | 21 | return engine.init(config) 22 | .then(function() { 23 | initialized = true; 24 | gitbook.events.trigger('search.ready'); 25 | }); 26 | } 27 | 28 | // Launch search for query q 29 | function query(q, offset, length) { 30 | if (!initialized) throw new Error('Search has not been initialized'); 31 | return engine.search(q, offset, length); 32 | } 33 | 34 | // Get stats about search 35 | function getEngine() { 36 | return engine? engine.name : null; 37 | } 38 | 39 | function isInitialized() { 40 | return initialized; 41 | } 42 | 43 | // Initialize gitbook.search 44 | gitbook.search = { 45 | setEngine: setEngine, 46 | getEngine: getEngine, 47 | query: query, 48 | isInitialized: isInitialized 49 | }; 50 | }); -------------------------------------------------------------------------------- /programs/backup_ver3.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | 4 | # 1. 백업할 파일과 디렉터리는 리스트에 지정됩니다. 5 | # 윈도우에서의 예: 6 | # source = ['"C:\\My Documents"', 'C:\\Code'] 7 | # macOS와 리눅스에서의 예: 8 | source = ['/Users/swa/notes'] 9 | # 이름에 공백이 포함된 문자열 안에서는 큰따옴표를 써야 합니다. 10 | 11 | # 2. 백업 파일은 메인 백업 디렉터리에 저장해야 합니다. 12 | # 윈도우에서의 예: 13 | # target_dir = 'E:\\Backup' 14 | # macOS와 리눅스에서의 예: 15 | target_dir = '/Users/swa/backup' 16 | # 사용할 폴더로 이 값을 변경하는 것을 잊지 마세요. 17 | 18 | # 대상 디렉터리가 존재하지 않는 경우 생성합니다 19 | if not os.path.exists(target_dir): 20 | os.mkdir(target_dir) # make directory 21 | 22 | # 3. 파일은 zip 파일로 백업됩니다. 23 | # 4. 현재 날짜를 메인 디렉터리 내의 하위 디렉터리명으로 사용합니다. 24 | today = target_dir + os.sep + time.strftime('%Y%m%d') 25 | # 현재 시간을 zip 파일의 이름으로 사용합니다. 26 | now = time.strftime('%H%M%S') 27 | 28 | # 사용자에게서 텍스트를 입력받아 zip 파일의 이름을 만듭니다. 29 | comment = input('Enter a comment --> ') 30 | # 텍스트를 입력했는지 검사합니다. 31 | if len(comment) == 0: 32 | target = today + os.sep + now + '.zip' 33 | else: 34 | target = today + os.sep + now + '_' + 35 | comment.replace(' ', '_') + '.zip' 36 | 37 | # 하위 디렉터리가 존재하지 않으면 생성합니다 38 | if not os.path.exists(today): 39 | os.mkdir(today) 40 | print('Successfully created directory', today) 41 | 42 | # 5. zip 명령어를 사용해 파일을 zip 파일에 추가합니다 43 | zip_command = "zip -r {0} {1}".format(target, 44 | ' '.join(source)) 45 | 46 | # 백업 실행 47 | print('Zip command is:') 48 | print(zip_command) 49 | print('Running:') 50 | if os.system(zip_command) == 0: 51 | print('Successful backup to', target) 52 | else: 53 | print('Backup FAILED') 54 | -------------------------------------------------------------------------------- /programs/backup_ver4.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | 4 | # 1. 백업할 파일과 디렉터리는 리스트에 지정됩니다. 5 | # 윈도우에서의 예: 6 | # source = ['"C:\\My Documents"', 'C:\\Code'] 7 | # macOS와 리눅스에서의 예: 8 | source = ['/Users/swa/notes'] 9 | # 이름에 공백이 포함된 문자열 안에서는 큰따옴표를 써야 합니다. 10 | 11 | # 2. 백업 파일은 메인 백업 디렉터리에 저장해야 합니다. 12 | # 윈도우에서의 예: 13 | # target_dir = 'E:\\Backup' 14 | # macOS와 리눅스에서의 예: 15 | target_dir = '/Users/swa/backup' 16 | # 사용할 폴더로 이 값을 변경하는 것을 잊지 마세요. 17 | 18 | # 대상 디렉터리가 존재하지 않는 경우 생성합니다 19 | if not os.path.exists(target_dir): 20 | os.mkdir(target_dir) # make directory 21 | 22 | # 3. 파일은 zip 파일로 백업됩니다. 23 | # 4. 현재 날짜를 메인 디렉터리 내의 하위 디렉터리명으로 사용합니다. 24 | today = target_dir + os.sep + time.strftime('%Y%m%d') 25 | # 현재 시간을 zip 파일의 이름으로 사용합니다. 26 | now = time.strftime('%H%M%S') 27 | 28 | # 사용자에게서 텍스트를 입력받아 zip 파일의 이름을 만듭니다. 29 | comment = input('Enter a comment --> ') 30 | # 텍스트를 입력했는지 검사합니다. 31 | if len(comment) == 0: 32 | target = today + os.sep + now + '.zip' 33 | else: 34 | target = today + os.sep + now + '_' + \ 35 | comment.replace(' ', '_') + '.zip' 36 | 37 | # 하위 디렉터리가 존재하지 않으면 생성합니다 38 | if not os.path.exists(today): 39 | os.mkdir(today) 40 | print('Successfully created directory', today) 41 | 42 | # 5. zip 명령어를 사용해 파일을 zip 파일에 추가합니다 43 | zip_command = 'zip -r {0} {1}'.format(target, 44 | ' '.join(source)) 45 | 46 | # 백업 실행 47 | print('Zip command is:') 48 | print(zip_command) 49 | print('Running:') 50 | if os.system(zip_command) == 0: 51 | print('Successful backup to', target) 52 | else: 53 | print('Backup FAILED') 54 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-lunr/search-lunr.js: -------------------------------------------------------------------------------- 1 | require([ 2 | 'gitbook', 3 | 'jquery' 4 | ], function(gitbook, $) { 5 | // Define global search engine 6 | function LunrSearchEngine() { 7 | this.index = null; 8 | this.store = {}; 9 | this.name = 'LunrSearchEngine'; 10 | } 11 | 12 | // Initialize lunr by fetching the search index 13 | LunrSearchEngine.prototype.init = function() { 14 | var that = this; 15 | var d = $.Deferred(); 16 | 17 | $.getJSON(gitbook.state.basePath+'/search_index.json') 18 | .then(function(data) { 19 | // eslint-disable-next-line no-undef 20 | that.index = lunr.Index.load(data.index); 21 | that.store = data.store; 22 | d.resolve(); 23 | }); 24 | 25 | return d.promise(); 26 | }; 27 | 28 | // Search for a term and return results 29 | LunrSearchEngine.prototype.search = function(q, offset, length) { 30 | var that = this; 31 | var results = []; 32 | 33 | if (this.index) { 34 | results = $.map(this.index.search(q), function(result) { 35 | var doc = that.store[result.ref]; 36 | 37 | return { 38 | title: doc.title, 39 | url: doc.url, 40 | body: doc.summary || doc.body 41 | }; 42 | }); 43 | } 44 | 45 | return $.Deferred().resolve({ 46 | query: q, 47 | results: results.slice(0, length), 48 | count: results.length 49 | }).promise(); 50 | }; 51 | 52 | // Set gitbook research 53 | gitbook.events.bind('start', function(e, config) { 54 | var engine = gitbook.search.getEngine(); 55 | if (!engine) { 56 | gitbook.search.setEngine(LunrSearchEngine, config); 57 | } 58 | }); 59 | }); 60 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-sharing/buttons.js: -------------------------------------------------------------------------------- 1 | require(["gitbook", "lodash"], function(gitbook, _) { 2 | var SITES = { 3 | 'facebook': { 4 | 'label': 'Facebook', 5 | 'icon': 'fa fa-facebook', 6 | 'onClick': function(e) { 7 | e.preventDefault(); 8 | window.open("http://www.facebook.com/sharer/sharer.php?s=100&p[url]="+encodeURIComponent(location.href)); 9 | } 10 | }, 11 | 'twitter': { 12 | 'label': 'Twitter', 13 | 'icon': 'fa fa-twitter', 14 | 'onClick': function(e) { 15 | e.preventDefault(); 16 | window.open("http://twitter.com/home?status="+encodeURIComponent(document.title+" "+location.href)); 17 | } 18 | }, 19 | 'google': { 20 | 'label': 'Google+', 21 | 'icon': 'fa fa-google-plus', 22 | 'onClick': function(e) { 23 | e.preventDefault(); 24 | window.open("https://plus.google.com/share?url="+encodeURIComponent(location.href)); 25 | } 26 | }, 27 | 'weibo': { 28 | 'label': 'Weibo', 29 | 'icon': 'fa fa-weibo', 30 | 'onClick': function(e) { 31 | e.preventDefault(); 32 | window.open("http://service.weibo.com/share/share.php?content=utf-8&url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title)); 33 | } 34 | }, 35 | 'instapaper': { 36 | 'label': 'Instapaper', 37 | 'icon': 'fa fa-instapaper', 38 | 'onClick': function(e) { 39 | e.preventDefault(); 40 | window.open("http://www.instapaper.com/text?u="+encodeURIComponent(location.href)); 41 | } 42 | }, 43 | 'vk': { 44 | 'label': 'VK', 45 | 'icon': 'fa fa-vk', 46 | 'onClick': function(e) { 47 | e.preventDefault(); 48 | window.open("http://vkontakte.ru/share.php?url="+encodeURIComponent(location.href)); 49 | } 50 | } 51 | }; 52 | 53 | 54 | 55 | gitbook.events.bind("start", function(e, config) { 56 | var opts = config.sharing; 57 | 58 | // Create dropdown menu 59 | var menu = _.chain(opts.all) 60 | .map(function(id) { 61 | var site = SITES[id]; 62 | 63 | return { 64 | text: site.label, 65 | onClick: site.onClick 66 | }; 67 | }) 68 | .compact() 69 | .value(); 70 | 71 | // Create main button with dropdown 72 | if (menu.length > 0) { 73 | gitbook.toolbar.createButton({ 74 | icon: 'fa fa-share-alt', 75 | label: 'Share', 76 | position: 'right', 77 | dropdown: [menu] 78 | }); 79 | } 80 | 81 | // Direct actions to share 82 | _.each(SITES, function(site, sideId) { 83 | if (!opts[sideId]) return; 84 | 85 | gitbook.toolbar.createButton({ 86 | icon: site.icon, 87 | label: site.text, 88 | position: 'right', 89 | onClick: site.onClick 90 | }); 91 | }); 92 | }); 93 | }); 94 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-highlight/ebook.css: -------------------------------------------------------------------------------- 1 | pre, 2 | code { 3 | /* http://jmblog.github.io/color-themes-for-highlightjs */ 4 | /* Tomorrow Comment */ 5 | /* Tomorrow Red */ 6 | /* Tomorrow Orange */ 7 | /* Tomorrow Yellow */ 8 | /* Tomorrow Green */ 9 | /* Tomorrow Aqua */ 10 | /* Tomorrow Blue */ 11 | /* Tomorrow Purple */ 12 | } 13 | pre .hljs-comment, 14 | code .hljs-comment, 15 | pre .hljs-title, 16 | code .hljs-title { 17 | color: #8e908c; 18 | } 19 | pre .hljs-variable, 20 | code .hljs-variable, 21 | pre .hljs-attribute, 22 | code .hljs-attribute, 23 | pre .hljs-tag, 24 | code .hljs-tag, 25 | pre .hljs-regexp, 26 | code .hljs-regexp, 27 | pre .ruby .hljs-constant, 28 | code .ruby .hljs-constant, 29 | pre .xml .hljs-tag .hljs-title, 30 | code .xml .hljs-tag .hljs-title, 31 | pre .xml .hljs-pi, 32 | code .xml .hljs-pi, 33 | pre .xml .hljs-doctype, 34 | code .xml .hljs-doctype, 35 | pre .html .hljs-doctype, 36 | code .html .hljs-doctype, 37 | pre .css .hljs-id, 38 | code .css .hljs-id, 39 | pre .css .hljs-class, 40 | code .css .hljs-class, 41 | pre .css .hljs-pseudo, 42 | code .css .hljs-pseudo { 43 | color: #c82829; 44 | } 45 | pre .hljs-number, 46 | code .hljs-number, 47 | pre .hljs-preprocessor, 48 | code .hljs-preprocessor, 49 | pre .hljs-pragma, 50 | code .hljs-pragma, 51 | pre .hljs-built_in, 52 | code .hljs-built_in, 53 | pre .hljs-literal, 54 | code .hljs-literal, 55 | pre .hljs-params, 56 | code .hljs-params, 57 | pre .hljs-constant, 58 | code .hljs-constant { 59 | color: #f5871f; 60 | } 61 | pre .ruby .hljs-class .hljs-title, 62 | code .ruby .hljs-class .hljs-title, 63 | pre .css .hljs-rules .hljs-attribute, 64 | code .css .hljs-rules .hljs-attribute { 65 | color: #eab700; 66 | } 67 | pre .hljs-string, 68 | code .hljs-string, 69 | pre .hljs-value, 70 | code .hljs-value, 71 | pre .hljs-inheritance, 72 | code .hljs-inheritance, 73 | pre .hljs-header, 74 | code .hljs-header, 75 | pre .ruby .hljs-symbol, 76 | code .ruby .hljs-symbol, 77 | pre .xml .hljs-cdata, 78 | code .xml .hljs-cdata { 79 | color: #718c00; 80 | } 81 | pre .css .hljs-hexcolor, 82 | code .css .hljs-hexcolor { 83 | color: #3e999f; 84 | } 85 | pre .hljs-function, 86 | code .hljs-function, 87 | pre .python .hljs-decorator, 88 | code .python .hljs-decorator, 89 | pre .python .hljs-title, 90 | code .python .hljs-title, 91 | pre .ruby .hljs-function .hljs-title, 92 | code .ruby .hljs-function .hljs-title, 93 | pre .ruby .hljs-title .hljs-keyword, 94 | code .ruby .hljs-title .hljs-keyword, 95 | pre .perl .hljs-sub, 96 | code .perl .hljs-sub, 97 | pre .javascript .hljs-title, 98 | code .javascript .hljs-title, 99 | pre .coffeescript .hljs-title, 100 | code .coffeescript .hljs-title { 101 | color: #4271ae; 102 | } 103 | pre .hljs-keyword, 104 | code .hljs-keyword, 105 | pre .javascript .hljs-function, 106 | code .javascript .hljs-function { 107 | color: #8959a8; 108 | } 109 | pre .hljs, 110 | code .hljs { 111 | display: block; 112 | background: white; 113 | color: #4d4d4c; 114 | padding: 0.5em; 115 | } 116 | pre .coffeescript .javascript, 117 | code .coffeescript .javascript, 118 | pre .javascript .xml, 119 | code .javascript .xml, 120 | pre .tex .hljs-formula, 121 | code .tex .hljs-formula, 122 | pre .xml .javascript, 123 | code .xml .javascript, 124 | pre .xml .vbscript, 125 | code .xml .vbscript, 126 | pre .xml .css, 127 | code .xml .css, 128 | pre .xml .hljs-cdata, 129 | code .xml .hljs-cdata { 130 | opacity: 0.5; 131 | } 132 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-search/search.js: -------------------------------------------------------------------------------- 1 | require([ 2 | "gitbook", 3 | "lodash" 4 | ], function(gitbook, _) { 5 | var index = null; 6 | var $searchInput, $searchForm; 7 | 8 | // Use a specific index 9 | function loadIndex(data) { 10 | index = lunr.Index.load(data); 11 | } 12 | 13 | // Fetch the search index 14 | function fetchIndex() { 15 | $.getJSON(gitbook.state.basePath+"/search_index.json") 16 | .then(loadIndex); 17 | } 18 | 19 | // Search for a term and return results 20 | function search(q) { 21 | if (!index) return; 22 | 23 | var results = _.chain(index.search(q)) 24 | .map(function(result) { 25 | var parts = result.ref.split("#") 26 | return { 27 | path: parts[0], 28 | hash: parts[1] 29 | } 30 | }) 31 | .value(); 32 | 33 | return results; 34 | } 35 | 36 | // Create search form 37 | function createForm(value) { 38 | if ($searchForm) $searchForm.remove(); 39 | 40 | $searchForm = $('
이 책에서 마음에 들지 않거나 이해하기 어렵거나 또는 단순히 잘못된 부분을 지적해줄 여러분과 같은 독자분들의 도움이 필요합니다. 의견이나 제안 사항을 이 책의 저자에게 알려주시거나 이 책의 번역자에게 보내주세요.
455 |한국어 번역판에 대한 의견은 wikibook@wikibook.co.kr로 보내주시기 바랍니다.
456 | 457 | 458 |저희에게 GNU/리눅스와 오픈소스의 세계를 소개해 주신 Kalyan Varma와 PESIT의 다른 여러 시니어 분들께 이 책을 바칩니다.
457 |저의 벗이자 저를 이끌어주셨던 그리운 Atul Chitnis를 기리며 이 책을 바칩니다.
458 |인터넷을 탄생시킨 선구자분들께 이 책을 바칩니다. 이 책은 2003년에 처음 씌였습니다만 여전히 인기를 누리고 있는데, 이것은 그분들이 상상하셨던 인터넷을 통한 지식 공유라는 특성 덕분입니다.
459 | 460 | 461 |.md 파일을 편집합니다.파이썬(Python)은 아마 단순하면서 강력한 몇 안 되는 프로그래밍 언어 중 하나일 것입니다. 파이썬은 초보자뿐만 아니라 전문가가 사용하기에 좋고, 그리고 더 중요한 건 파이썬을 이용하면 재미있게 프로그래밍할 수 있다는 것입니다. 이 책은 이처럼 멋진 언어를 배우는 것을 돕고 업무를 빠르고 고통 없이 처리하는 방법을 보여줌으로써 사실상 '프로그래밍 문제에 대한 해독제' 역할을 하는 데 목적이 있습니다.
457 |이 책은 파이썬 프로그래밍 언어에 대한 가이드 또는 자습서 역할을 합니다. 이 책은 주로 초심자를 대상으로 하며, 숙련된 프로그래머에게도 유용합니다.
459 |컴퓨터에 관한 지식으로 텍스트 파일을 저장하는 방법 정도만 아는 분이라도 이 책을 통해 파이썬을 배울 수 있습니다. 이전에 프로그래밍해본 경험이 있더라도 이 책을 통해 파이썬을 배울 수 있습니다.
460 |이전에 프로그래밍해본 경험이 있다면 파이썬과 여러분이 즐겨 쓰는 프로그래밍 언어와의 차이점이 무엇인지 궁금할 것입니다. 저는 그러한 여러 차이점을 강조해 왔습니다. 그럼에도 조심스럽게 경고하자면 파이썬은 금방 여러분이 즐겨쓰는 프로그래밍 언어가 될 것입니다.
461 |이 책의 공식 웹사이트는 https://python.swaroopch.com/이며, 이곳에서 책 전체를 읽거나 최신 버전의 책을 내려받거나 종이책을 구입할 수 있으며, 저에게 피드백을 주실 수 있습니다.
463 |465 |469 | 470 | 471 |소프트웨어를 설계하는 두 가지 방법이 있다. 하나는 아주 단순하게 만들어서 분명하게 눈에 띄는 결함이 없게 하는 것이고, 다른 하나는 아주 복잡하게 만들어서 분명하게 눈에 띄는 결함이 없게 하는 것이다. -- C. A. R. 호어(Hoare)
466 | 467 |인생의 성공은 재능과 기회보다는 집중력과 인내의 문제다. -- C. W. 웬드(Wendte)
468 |
이 책을 만드는 데 사용한 거의 모든 소프트웨어는 FLOSS입니다.
457 |이 책의 초판에서는 레드햇 9.0 리눅스를 이 책의 기본 집필 환경으로 활용했고, 이 책의 6차 개정판에서는 페도라 코어 3 리눅스를 이 책의 기본 집필 환경으로 활용했습니다.
459 |초기에는 이 책을 쓰는 데 KWord를 이용했습니다(개정 이력에서 설명하고 있습니다).
460 |이후로 Kate를 이용한 DocBook XML으로 바꿨는데 너무 지루하다고 느꼈습니다. 그래서 서식을 제어하기가 좋고 PDF 생성이 가능한 OpenOffice로 바꿨는데 문서에서 만들어지는 HTML이 너무 엉성했습니다.
462 |최종적으로 XEmacs를 발견하고 DocBook XML 형식이 장기적인 관점에서 가장 나은 방법이라 판단하고 이 책을 DocBook XML(다시 한번)로 처음부터 다시 썼습니다.
463 |6차 개정판에서는 Quanta+를 이용해 모든 편집 작업을 처리하기로 마음먹었습니다. 페도라 코어 3 리눅스에 포함된 표준 XSL 스타일시트가 사용되고 있었습니다. 그러나 HTML 페이지에 색상과 스타일을 지정하는 CSS 문서를 작성했고, 모든 프로그램 코드에 문법 강조를 자동으로 적용하는 렉시컬 분석기도 파이썬으로 대충 작성했습니다.
464 |7차 개정판에서는 MediaWiki를 기본 집필 환경으로 사용했습니다. 저는 모든 것을 온라인에서 편집하고 독자분들이 직접 위키 웹사이트 내에서 읽고/편집하고/논의할 수 있었지만 결국 글을 쓰는 것보다 스팸을 처리하는 데 더 많은 시간을 보내게 됐습니다.
465 |8차 개정판에서는 Vim, Pandoc, Mac OS X을 사용했습니다.
466 |9차 개정판에서는 AsciiDoc 포맷으로 바꾸고 Emacs 24.3, 467 | tomorrow 테마, 468 | Fira Mono 글꼴, adoc-mode를 사용해 책을 썼습니다.
469 |2016: AsciiDoctor에서 C/C++의 ++가 사라지는 것과 같은 갖가지 자잘한 렌더링 문제를 처리하는 데 지쳤고 사소한 사항들을 이스케이프하는 것을 관리하기가 어려웠습니다. 게다가 복잡한 Asciidoc 형식 때문에 텍스트를 편집하기가 꺼려졌습니다.
10차 개정판에서는 Spacemacs 에디터를 이용해 Markdown + GitBook 포맷으로 쓰는 방식으로 바꿨습니다.
472 |https://www.swaroopch.com/about/을 참고하세요.
474 | 475 | 476 |