zoukankan      html  css  js  c++  java
  • python笔记

    # coding=utf-8 定义后可使用中文
    #var定义输出
    i=1
    print(i)
    #if
    if i>0:
    print(i)
    else:
    print("x")
    #循环+字符串拼接
    for i in range(1,100):
    print("hello {0} {1}".format(i,"fei"))
    #定义函数
    def sayhello():
    print("hello world!")
    sayhello()
    #写个递归吧
    def f(n):
    if(n==1 or n==0):
    return 1
    else:
    return f(n-1)*n
    print(f(0))
    #面向对象
    class HI:
    def __init__(self,name):
    self.name=name
    def out(self):
    print("HI {0}".format(self.name))
    hi=HI("XXX")
    hi.out()
    #继承
    class hello(HI):
    def __init__(self,name):
    HI.__init__(self,name)
    def out2(self):
    print("Hello {0}".format(self.name))
    #引入文件
    import macpath
    c1="hello "*2
    print(c1)
    #元组和列表:元组可读不可写,列表可读可写,元组使用(),列表使用[]
    #集合运算
    a=set("abcde")
    b=set("ad")
    #运算
    y=a&b
    x=a-b
    y=a|b
    #消除重复元素
    new=set(a)
    #字典
    k={"name":"xx","sex":"male","age":"20"}
    print(k["name"])
  • 相关阅读:
    linux下activemq安装
    java 线程方法join
    创建线程池
    游标储存过程
    返回结果集的储存过程
    linux 安装 reids 出错解决问题
    IDEAL 集成 jFINAL 问题
    oracle 游标
    oracle procedures
    Linux下安装Tomcat服务器
  • 原文地址:https://www.cnblogs.com/qiangge666/p/4752036.html
Copyright © 2011-2022 走看看