예제 #1
0
# -*- coding: utf-8 -*-
import json
import os
js = '{"taobao":[{"allOrderId":"12333440","product":"product0","price":"10.00"},{"allOrderId":"12333441","product":"product1","price":"10.01"}],"materialAllOrder2":[{"allOrderId":"12333440","product":"product0","price":"10.00"}]}'
# print js
# fo = open("./test.json", "w")
# fo.write(js)
# fo.close()
# with open("./test.json", "a") as ff:
#     ff.writelines(js)
import test
test.a()
예제 #2
0
    return a+b

print(increment(10))
print(increment(10, 2))

			# variable value may be used for default value
			# value that is actual at the time of 
			# function difinition will be used

			# if def value is mutable, 
			# mutations will be preserved from call to call
def a(a, L=[]):
    L.append(a)
    return L

a(1)                                    # [1]
a(2)                                    # [1, 2]
a(3,[])                                 # [3]
a(4)                                    # [1, 2, 4]

def a(a, L=None):                       # this is the trick for preventing this 
    if L is None: 
        L=[]
    L.append(a)
    return L


# keyword arguments

def addingManyValues(a, b=1, c=2):
    return a + b + c
예제 #3
0
import test
print(test.a())
예제 #4
0
파일: 1.py 프로젝트: zelcookie/study
import test
import os
import sys

test.a()

sys.stdout.write('haumy,donja!\n')