摘要:
__author__ = '12711'#-*- coding:utf-8 -*-F=set([1,2,3,4,5])#创建一个数字集合G=set([1])S=set("abcd")#创建一个字符集合print(F&G)#交集print(F|G)#并集print(F-G)#差集print(F^G)# 阅读全文
摘要:
__author__ = '12711'#-*- coding:utf-8 -*-'''info={ '0001':"xiaoming", '0002':"xiaohua", '0003':"xiaohong", '0004':"xiaonv" #格式info{'Key':"name",' '," 阅读全文
摘要:
#!/usr/bin/env python# -*- coding:utf-8 -*-name = "KXK \tis your {name} and i am {year} old"print(name.capitalize()) #首字母大写print(name.count("K")) #统计有 阅读全文
摘要:
#-*- coding:utf-8 –*-Commodity=[['iPhone',6000],['Coffee',30],['Computer',10000]]Salary=int(input("Input your salary"))cout=0Names1=[]while cout==0: f 阅读全文
摘要:
import copyNames=["xiaoming","xiaohong",["qu","ren","tian"],"xiaohuang","xiaolu","xiaohua"]#Names1=[1,2,3,4]#print(Names)print(Names[2][1])#打印出“ren”#p 阅读全文
摘要:
1:Python给变量赋值不属于提前定义变量和变量的声明。例如:Example='abc'或Example=123 这个方法看起来比较简单和容易减少了其他语言要先声明的麻烦,但是也有很大的不严谨性。 2:Python的循环 2.1 while循环 while和C语言Java的用法一样,比如我要打印 阅读全文