摘要:
#!/usr/bin/env pythondata = { '北京':{ "昌平":{ "沙河":["oldboy","test"], "天通苑":["链家地产","我爱我家"] }, "朝阳":{ "望京":["奔驰","陌陌"], "国贸":{"CICC","HP"}, "东直门" 阅读全文
摘要:
#!/usr/bin/env pythoninfo = { 'stu1101': "TengLan Wu", 'stu1102': "LongZe Luola", 'stu1103': "XiaoZe Maliya",}print(info)print(info['stu1101'])info['s 阅读全文
摘要:
My name is {name} and my age is {year}5 my name is {name} and my age is {year} Falsemy name is {name} and my age is {year}3my name is lian and my age 阅读全文
摘要:
#!/usr/bin/env pythonproduct_list = [ ('Iphone',5800), ('Mac Pro',9800), ('Bike',800), ('Watch',10600), ('Coffee',31), ('Alex Python',120),]shopping_l 阅读全文
摘要:
元组其实跟列表差不多,也是存一组数,只不是它一旦创建,便不能再修改,所以又叫只读列表 语法 1 names = ("alex","jack","eric") 1 names = ("alex","jack","eric") 1 names = ("alex","jack","eric") 1 nam 阅读全文
摘要:
['alex', ['saving', 50]]['fengjie', ['saving', 50]] 阅读全文
摘要:
我爱北京b'\xe6\x88\x91\xe7\x88\xb1\xe5\x8c\x97\xe4\xba\xac'我爱北京 阅读全文
摘要:
1 result = 值1 if 条件 else 值2 1 result = 值1 if 条件 else 值2 1 result = 值1 if 条件 else 值2 1 result = 值1 if 条件 else 值2 result = 值1 if 条件 else 值2 如果条件为真:resul 阅读全文
摘要:
#!/usr/bin/env pythonimport sysprint(sys.path)#打印环境变量print(sys.argv)#打印['F:/python/s14/day2/sys.py']及输入参数import oscmd_res = os.system("dir")#调用系统命令,直接 阅读全文
摘要:
info1=''' info of %s age:%djob:%s''' %( name,int(age),job)print(info1) info2=''' info of {_name} age:{_age}job:{_job}'''.format( _name=name, _age=age, 阅读全文
摘要:
有一种循环叫死循环,一经触发,就运行个天荒地老、海枯石烂。 海枯石烂代码 1 2 3 4 5 count = 0 while True: print("你是风儿我是沙,缠缠绵绵到天涯...",count) count +=1 1 2 3 4 5 count = 0 while True: print 阅读全文
摘要:
最简单的循环10次 1 2 3 4 5 6 #_*_coding:utf-8_*_ __author__ = 'Alex Li' for i in range(10): print("loop:", i ) 1 2 3 4 5 6 #_*_coding:utf-8_*_ __author__ = ' 阅读全文
摘要:
1 2 3 4 5 6 7 #!/usr/bin/env python #_*_coding:utf-8_*_ #name = raw_input("What is your name?") #only on python 2.x name = input("What is your name?") 阅读全文
摘要:
python解释器在加载 .py 文件中的代码时,会对内容进行编码(默认ascill) ASCII(American Standard Code for Information Interchange,美国标准信息交换代码)是基于拉丁字母的一套电脑编码系统,主要用于显示现代英语和其他西欧语言,其最多 阅读全文
摘要:
Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descri 阅读全文
摘要:
windows 1 2 3 4 5 6 7 1、下载安装包 https://www.python.org/downloads/ 2、安装 默认安装路径:C:\python37 3、配置环境变量 【右键计算机】--》【属性】--》【高级系统设置】--》【高级】--》【环境变量】--》【在第二个内容框中 阅读全文
摘要:
In summary : Python 2.x is legacy, Python 3.x is the present and future of the language Python 3.0 was released in 2008. The final 2.x version 2.7 rel 阅读全文
摘要:
当我们编写Python代码时,我们得到的是一个包含Python代码的以.py为扩展名的文本文件。要运行代码,就需要Python解释器去执行.py文件。 由于整个Python语言从规范到解释器都是开源的,所以理论上,只要水平够高,任何人都可以编写Python解释器来执行Python代码(当然难度很大) 阅读全文