Skip to content

Instantly share code, notes, and snippets.

@Luavis
Created April 12, 2014 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Luavis/10537015 to your computer and use it in GitHub Desktop.
Save Luavis/10537015 to your computer and use it in GitHub Desktop.
python example code
#!/usr/bin/env python
"""
* Writing By Luavis
"""
# -*- coding:utf-8 -*-
import time
def date():
print (time.strftime("%H:%M:%S"))
def deco(inner):
def go(*args, **kargs):
if(kargs.get('data', '') != ''):
kargs['data'] = "Hello?"
inner(*args, **kargs)
return go
@deco
def function(data, another):
print(data)
print(another)
class super:
pass
class A(super):
value = 1
def __init__(self):
self.m_value = 1
@staticmethod
def static(data):
print(data)
print(A.value)
def a(self, data):
print(data)
case = 1
if case == 1:
date()
function("function", 'Hello2')
function(data = "function2", another = 'Hello2')
A.static("Hello")
a = A()
a.a(A.value)
elif not case == 2:
pass
else:
pass
while case != 1:
case = 2
print('for loop')
for x in range(1,10):
print(x)
print('Today we lerned python.')
print(u'今日はパイセンを勉強しました。')
print(u'오늘은 파이썬을 공부했습니다.')
print(type('안녕하세요.'))
print(type(u'안녕하세요.'))
try:
zero_div = 1 / 0;
except Exception, e:
print('Error!?')
print(e.message)
else:
pass
finally:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment