예제 #1
0
파일: Packed.py 프로젝트: teleamigos/TIR_PF
 def __init__(self,MyMacAdd,ID):
     self.myMACadd=MyMacAdd
     self.broadcast=b'\xff\xff\xff\xff\xff\xff'
     self.protocol=b'\x08\x01'
     self.payload=''
     self.Type_message={
     'Hello':'0',
     'MPR_message':'1',
     'Message':'2'
     }
     self.tp=Topology(ID)
     self.msj_out=''
     self.message_Hello=Hello(ID)
     self.message_MPR=MPRmsj(ID)
     self.message=Message(ID)
     self.temperature=0
예제 #2
0
class Gender(Enum):
    Male = 0
    Female = 1


print(Gender.Male)


# type
def fn(self, name='world'):
    print('hello, %s' % name)


Hello = type('Hello', (object, ), dict(hello=fn, att='hello'))

h = Hello()
h.hello()
h.__name = 'nihao'
print(h.__name)
print(h.att)

# metaclass magic code
t_1 = []

# t_1.add('1')


# ORM + METACLASS
class Field(object):
    def __init__(self, name, column_type):
        self.name = name
def main():
    # APP CODE
    app = Hello.Hello()
    print app.hello_world()
예제 #4
0
def hello_handler(ws, **kwargs):
    message = Hello(message="hello, world!")
    while ws.open:
        yield from ws.send(Hello.dumps(message))
        yield from asyncio.sleep(1)
예제 #5
0
파일: dog.py 프로젝트: Stting14/test02
#question=['name','quest','favorite color']
#answer=['lancelot','the only grail','blue']
#for q,a in zip(question,answer):
#    print('what is your{0}?  it is {1}.'.format(q,a))

#for i in reversed(range(1,10,2)):
#    print (i)
#basket=['apple','orange','apple','pear','orange','banaer']
#for f in sorted(set(basket)):
#    print (f)

#import sys

#print("命令行参数如下:")
#for i in sys.argv:
#    print(i)

#print ('\n\npython 路径为:',sys.path,'\n')

#!/usr/bin/python3
# Filename: Hello.py

if __name__ == '__main__':
    print('程序自身在运行')
else:
    print('我来自其他模块')

import Hello
Hello()
예제 #6
0
파일: Main.py 프로젝트: jppriet0/CAAP-CS
def welcome():
    program = input(
        "What program do you want to use? (type '?' for a list of programs)... "
    )

    if (program == "?"):
        list = ("- Hello: Type 'hello'",
                "- Celsius/farenheit converter: Type: 'temp'",
                "- Parsec/light year converter: Type 'astro'",
                "- Sigma (sum calculator): Type: 'sigma'",
                "- Fibonnaci term finder: Type 'fibo'",
                "- Coin change # calculator: Type: 'coins'",
                "To exit, write 'exit'")

        for words in list:

            print(words)

        welcome()
    elif (program == "hello"):
        print("")
        print("-----------------------------------------------------------")
        print("")
        try:
            import Hello
            Hello.Hello()
        except:
            input(
                "Sorry, an error has been found. Press ENTER to return to the main screen"
            )
        print("")
        print("-----------------------------------------------------------")
        print("")
        welcome()
    elif (program == "temp"):
        print("")
        print("-----------------------------------------------------------")
        print("")
        try:
            import tempcon
            tempcon.convertT()
        except:
            input(
                "Sorry, an error has been found. Press ENTER to return to the main screen"
            )
        print("")
        print("-----------------------------------------------------------")
        print("")
        welcome()
    elif (program == "astro"):
        print("")
        print("-----------------------------------------------------------")
        print("")
        try:
            import astrocon
            astrocon.convertA()
        except:
            input(
                "Sorry, an error has been found. Press ENTER to return to the main screen"
            )
        print("")
        print("-----------------------------------------------------------")
        print("")
        welcome()
    elif (program == "sigma"):
        print("")
        print("-----------------------------------------------------------")
        print("")
        try:
            import Sigma
            Sigma.sigma()
        except:
            input(
                "Sorry, an error has been found. Press ENTER to return to the main screen"
            )
        print("")
        print("-----------------------------------------------------------")
        print("")
        welcome()
    elif (program == "fibo"):
        print("")
        print("-----------------------------------------------------------")
        print("")
        try:
            import Fibonnaci
            Fibonnaci.main()
        except:
            input(
                "Sorry, an error has been found. Press ENTER to return to the main screen"
            )
        print("")
        print("-----------------------------------------------------------")
        print("")
        welcome()
    elif (program == "coins"):
        print("")
        print("-----------------------------------------------------------")
        print("")
        try:
            import coins
            coins.count()
        except:
            input(
                "Sorry, an error has been found. Press ENTER to return to the main screen"
            )
        print("")
        print("-----------------------------------------------------------")
        print("")
        welcome()
    elif (program == "exit"):
        exit()
    else:
        print("Program not available, verify name")
        welcome()
예제 #7
0
파일: Bye.py 프로젝트: upendra431/ML
 def byeb(self):
     print("Bye")
     Hello().hi()
예제 #8
0
import Hello as H
H.Hello("Amani")

import platform

print(platform.python_version())