示例#1
0
def main():
   ts = time()
   hello()
   client_id = os.getenv('IMGUR_CLIENT_ID')
   if not client_id:
       raise Exception("Couldn't find IMGUR_CLIENT_ID environment variable!")
   download_dir = setup_download_dir()
   links = [l for l in get_links(client_id) if l.endswith('.jpg')]
   print(download_dir)
   testurl = u'http://i.imgur.com/i5QjTPA.jpg'
   download_link(download_dir, testurl)
   for link in links:
       download_link(download_dir, link)
   print('Took {}s'.format(time() - ts))
示例#2
0
def message(requests):
    message = ((requests.body).decode('utf-8'))

    if (message.find(u'ㅎㅇ') > -1 or message.find(u'안녕') > -1):
        return_str = (test.hello())  #.decode('utf-8') + "안녕하세요!!!\n"

    elif (message.find(u'학생회관') > -1 or message.find(u'학관') > -1
          or message.find(u'ㅎㄱ') > -1):
        return_str = cafeteria.students_hall()

    elif (message.find(u'우정') > -1 or message.find(u'ㅇㅈ') > -1):
        return_str = cafeteria.woojung()

    elif (message.find(u'군자') > -1 or message.find(u'ㄱㅈ') > -1):
        return_str = cafeteria.gunja()

    else:
        return_json_str = json.loads(message)
        return_str = return_json_str['content']

    return JsonResponse({
        'message': {
            'text': return_str
        },
        'keyboard': {
            'type': 'text'
        }
    })
示例#3
0
import sched
from test import hello
import test
print sched.a
print hello()
print hello.__name__
print __name__
print test.__name__
示例#4
0
 def test_prints_hello_test(self):
     output = test.hello()
     assert (output == self.hello_message)
示例#5
0
#在python中一个py文件可以称为一个模块,模块名即文件名
#python按目录组织模块的方法称为包package,包目录下有__init__.py文件
#__init__.py文件也是一个模块,模块名即包名,系统自带sys模块

import test

print(1)
print(test.hello())

print(test.__doc__)
#作用域__author__ __name__属于特殊变量,可以直接引用
#_xx和__xx类似的变量是private,不应该被直接引用


def _private1(name):
    print('hello %s' % name)


def _private2(name):
    print('hi %s' % name)


def greeting(name):
    if len(name) > 3:
        _private2(name)
    else:
        _private2(name)


greeting('222222')
示例#6
0
def run():
    test.hello()
    return render_template('index.html')
示例#7
0
#!/usr/bin/env python

import math
import test
import webbrowser

print math.sin(1.570)  #value in radian
test.hello()

print __name__
print test.__name__

print range.__doc__
webbrowser.open

print ''
print ''
print ''
print '   ----   '
print ''
print ''
print ''

a = set([1,2,3])
b = set([2,3,4])
print a&b
print a|b
print a-b
print (a&b).issubset(a)
print (a&b)<=a
print (a&b)>=b
示例#8
0
def get():
    # ↓ 実行したいファイルの関数
    return test.hello()
示例#9
0
print(fact(2000))

foo = 100
 
def hello():
    print("Eu sou o test.py")
 
if __name__ == "__main__":
    print("Executando como programa principal")
    print('O valor de __name__ e:' , __name__)
    hello()

import test

print(test.foo)
test.hello()
 
print(test.__name__)


def multiplicacao(x,y):
    return x*y

print(multiplicacao(5,8))

lam = lambda x,y: x*y
print(lam(10,9))


print((lambda a,b : a+b)(30,70))
import sys
sys.path.append("C:\\Users\\vishw\\OneDrive\\Desktop\\Py pepinput\\day6")
from test import hello
hello()
#!/bin/usr/env python3

import test

test.hello();