"Python HelloWorld Class"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(사용자 2명의 중간 판 7개는 보이지 않습니다)
1번째 줄: 1번째 줄:
;Python HelloWorld Class
;Python HelloWorld Class
;파이썬 HelloWorld 클래스


==소스 코드==
==소스 코드==
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote ~]# cat hello_world.py  
[root@zetawiki ~]# cat hello_world.py  
#!/usr/bin/python
#!/usr/bin/python
class HelloWorld:
class HelloWorld:
10번째 줄: 11번째 줄:
hw = HelloWorld()
hw = HelloWorld()
hw.f()
hw.f()
</source>
</syntaxhighlight>


==실행 결과==
==실행 결과==
<source lang='dos'>
<syntaxhighlight lang='console'>
[root@jmnote~]# python hello_world.py
[root@zetawiki~]# python hello_world.py
Hello, world!
Hello, world!
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==
*[[Python hello world]]
*[[Python hello world]]
*[[클래스]]
==참고==
*https://docs.python.org/2/tutorial/classes.html


[[분류: Python]]
[[분류: Python]]

2020년 11월 2일 (월) 02:31 기준 최신판

Python HelloWorld Class
파이썬 HelloWorld 클래스

1 소스 코드[ | ]

[root@zetawiki ~]# cat hello_world.py 
#!/usr/bin/python
class HelloWorld:
	def f(self):
		print "Hello, world!"
hw = HelloWorld()
hw.f()

2 실행 결과[ | ]

[root@zetawiki~]# python hello_world.py
Hello, world!

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}