def __init__(self, init, tn=None): if init: self.a = a.a() self.tn = self.a.tn print "init is finished!" else: self.tn = tn print "no need to init!" self.b = b.b()
def b(input): target = a(input, 25) input = [int(i) for i in input] l = 2 print(target) while True: print(l) for i in range(len(input) - (l - 1)): if sum(input[i:i + l]) == target: smallest = min(input[i:i + l]) largest = max(input[i:i + l]) return smallest, largest, smallest + largest l += 1
def main(): my_a = a.a() logger = my_a.getLogger() my_b = b.b() print("main > start operation...") my_b.operation("123", logger) my_b.operation("456", logger) my_b.operation("789", logger) print("main > start print_log...") my_a.print_log() print("main > logger size is", len(logger))
# Paisan.py # By Paisan Khonjumpa (c) May 2015 # import sys import a as myLamda import b as myFunc # print("The operating system is ", sys.platform) # def a(x): # return lambda x: x + 5 z = myLamda.a(4) print(z(9)) y = myFunc.myStringPrint("test") print("Funciton output is ", y)
a + a a and b a.x = a assert a a = a a, a = a [a, a] = a 'a' a += a `a` a & a a | a a ^ a break a() class a: pass a < a continue @a def a(): pass a(a=a) {} a / a a[...] exec a a // a for a in a: pass from a import a (a for a in a if a) a.a
#!/usr/bin/python #-*- coding:utf-8 -*- ''' author:guomeng email:[email protected] ''' import sys sys.path.append('/home/guomeng/study/python/testimport/root') from a import a a()
def c(): print("----c---") a()
import a aff = "al" a.a()
from time import sleep import a import b if __name__ == '__main__': a.a() sleep(3) b.b()
#파이썬에서는 import라고 하면 뒤에 불러올 파이썬 파일을 찾음!! import a import B #import a, B라고 하는 걸 더 권장 print(a.a()) print(B.B()) #yunjin이라는 모듈에서 a 함수만 불러오고 싶을 땐? from yunjin import a print(a()) #이렇게 가져오면 yunjin을 명시할 필요X #아예 모듈을 가져오면 명시해야 하지만... from yunjin import B as print_B #B를 print_B라는 이름으로 가져오고 싶다. print(print_B()) import a as print_a # 파일 이름인 모듈 a를 print_a라는 함수 이름으로 쓰고 싶다 print(print_a.a()) #from 없이 import만 있으면 모듈을 가져오는 것이고, from과 함께 있으면 함수만 가져오는 것! #import가 가져오는 건 모듈일 수도, 함수일 수도 있다!
def b(): print("-----b-----") a()
import os from a import a from b import b file_path = os.path.dirname(os.path.realpath(__file__)) input_path = file_path + "/input.txt" inpt = open(input_path, 'r') print(a(inpt)) inpt = open(input_path, 'r') print(b(inpt))
def test_s2_a(): assert b.a() == 42
def test_s1_a(): assert a.a() == 42
def c(): print('ccc') a()
import os, sys, pprint sys.path.append(os.path.dirname( os.getcwd())) #我将父文件目录导入到系统运行目录中,然后就可以导入父亲目录下的模块了 pprint.pprint(sys.path) # import testImport # import testImport.a from a import a print(a())
def c(): a()
import os from a import a from b import b file_path = os.path.dirname(os.path.realpath(__file__)) input_path = file_path + "/input.txt" inpt = open(input_path, 'r') print('A result:', a(inpt)) inpt = open(input_path, 'r') print('B result:', b(inpt))
def test_a(): a.a()
def test_a(): assert b.a() == 42
def test_a(): assert a.a() == 42
def c(): print("---3---") a()
from simple_node import SimpleNode from async_node import AsyncNode from a import a from b import b # you can insert some playground code here aa = a() bb = b() bb.meth()
def b(): print("---2---") a()
avg_a_count = [] # Y axis 1 avg_bfs_count = [] # Y axis 2 m = maze.Maze(width, height, .5) density = 0 while density < 1: # for each density density += interval a_count = 0 bfs_count = 0 i = 0 while i < tries: # for each try, generate another maze and get the count i += 1 m.generate_maze(density) a_result = a.a([], m, (1, 1), (height - 2, width - 2)) bfs_result = bfs.bfs([], m, (1, 1), (height - 2, width - 2)) a_count += a_result bfs_count += bfs_result densities.append(density) avg_a_count.append(a_count / tries) avg_bfs_count.append(bfs_count / tries) print(("Avg a count at density {density} is {count}").format( density=density, count=a_count / tries)) print(("Avg bfs count at density {density} is {count}").format( density=density, count=bfs_count / tries)) data = json.dumps({ "densities": densities,
import os from a import a from b import b file_path = os.path.dirname(os.path.realpath(__file__)) input_path = file_path + "/input.txt" inpt = [ line.strip() for line in open(input_path, 'r')] print("result A:", a(inpt)) print("result B:", b(inpt))
import numpy as np import time from a import a from r import r from t import t_ciz as t from u import u from k import k a = a() r = r() t = t() u = u() k = k() iki_br = np.zeros((20, 3)) ataturk = np.column_stack((a, t, a, t, u, iki_br, r, k)) for i in range(20): for j in range(142): if ataturk[i][j] == 1: print('*', end='') else: print(' ', end='') print('') time.sleep(.100)