摘要:
一.下载Android studio https://developer.android.google.cn/studio/ 二.安装 首先移动 弹出下面弹框,直接点击OK 提示无法访问Android SDK,直接cancel 弹出如下界面,直接next 选择标准模式,点击next 接下来弹出ui主
阅读全文
posted @ 2018-11-19 23:02
anobscureretreat
阅读(451)
推荐(0)
摘要:
myDict = {'a':1,'b':2,'c':3,'d':4} print(myDict) if 'a' in myDict: del myDict['a'] print(myDict)
阅读全文
posted @ 2018-11-19 20:46
anobscureretreat
阅读(203)
推荐(0)
摘要:
def is_vowel(char): all_vowels = 'aeiou' return char in all_vowels print(is_vowel('c')) print(is_vowel('e'))
阅读全文
posted @ 2018-11-19 20:12
anobscureretreat
阅读(2960)
推荐(0)
摘要:
# Python program to convert decimal number into binary, octal and hexadecimal number system # Change this line for a different result dec = 344 print("The decimal value of",dec,"is:") print(bin(d...
阅读全文
posted @ 2018-11-19 20:02
anobscureretreat
阅读(178)
推荐(0)
摘要:
def convertToBinary(n): """Function to print binary number for the input decimal using recursion""" if n > 1: convertToBinary(n//2) print(n % 2,end = '') # decimal number dec = ...
阅读全文
posted @ 2018-11-19 19:58
anobscureretreat
阅读(1360)
推荐(0)
摘要:
# Program to generate a random number between 0 and 9 # import the random module import random print(random.randint(0,9))
阅读全文
posted @ 2018-11-19 19:54
anobscureretreat
阅读(176)
推荐(0)
摘要:
import platform import os print(os.name) print(platform.system()) print(platform.release())
阅读全文
posted @ 2018-11-19 19:52
anobscureretreat
阅读(256)
推荐(0)
摘要:
from datetime import date f_date = date(2014, 7, 2) l_date = date(2014, 7, 11) delta = l_date - f_date print(delta.days)
阅读全文
posted @ 2018-11-19 19:47
anobscureretreat
阅读(1131)
推荐(1)
摘要:
# For 32 bit it will return 32 and for 64 bit it will return 64 import struct print(struct.calcsize("P") * 8)
阅读全文
posted @ 2018-11-19 19:43
anobscureretreat
阅读(621)
推荐(0)
摘要:
import os # Access all environment variables print('*---------------ENVIRON-------------------*') print(os.environ) print('*----------------HOME------------------*') # Access a particula...
阅读全文
posted @ 2018-11-19 19:41
anobscureretreat
阅读(4605)
推荐(0)
摘要:
class Rectangle(): def __init__(self, l, w): self.length = l self.width = w def rectangle_area(self): return self.length*self.width newRectangle =...
阅读全文
posted @ 2018-11-19 19:36
anobscureretreat
阅读(266)
推荐(0)
摘要:
新建test.py 运行 然后查看当前目录的runtest.log,会看到下面的结果
阅读全文
posted @ 2018-11-19 18:29
anobscureretreat
阅读(137)
推荐(0)
摘要:
my_dict = {'data1':100,'data2':-54,'data3':247} result=1 for key in my_dict: result=result * my_dict[key] print(result)
阅读全文
posted @ 2018-11-19 10:30
anobscureretreat
阅读(1572)
推荐(0)
摘要:
keys = ['red', 'green', 'blue'] values = ['#FF0000','#008000', '#0000FF'] color_dictionary = dict(zip(keys, values)) print(color_dictionary)
阅读全文
posted @ 2018-11-19 10:27
anobscureretreat
阅读(700)
推荐(0)
摘要:
d = {'x': 10, 'y': 20, 'z': 30} for dict_key, dict_value in d.items(): print(dict_key,'->',dict_value)
阅读全文
posted @ 2018-11-19 10:25
anobscureretreat
阅读(8281)
推荐(0)
摘要:
my_dict = {'x':500, 'y':5874, 'z': 560} key_max = max(my_dict.keys(), key=(lambda k: my_dict[k])) key_min = min(my_dict.keys(), key=(lambda k: my_dict[k])) print('Maximum Value: ',my_di...
阅读全文
posted @ 2018-11-19 10:23
anobscureretreat
阅读(2588)
推荐(0)
摘要:
dic1={1:10, 2:20} dic2={3:30, 4:40} dic3={5:50,6:60} dic4 = {} for d in (dic1, dic2, dic3): dic4.update(d) print(dic4)
阅读全文
posted @ 2018-11-19 10:16
anobscureretreat
阅读(191)
推荐(0)
摘要:
d = {1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60} def is_key_present(x): if x in d: print('Key is present in the dictionary') else: print('Key is not present in the dictionar...
阅读全文
posted @ 2018-11-19 10:15
anobscureretreat
阅读(1958)
推荐(0)
摘要:
my_dict = {} if not bool(my_dict): print("Dictionary is empty")
阅读全文
posted @ 2018-11-19 10:12
anobscureretreat
阅读(25560)
推荐(1)
摘要:
d = {0:10, 1:20} print(d) d.update({2:30}) print(d)
阅读全文
posted @ 2018-11-19 10:11
anobscureretreat
阅读(848)
推荐(0)
摘要:
class dictObj(object): def __init__(self): self.x = 'red' self.y = 'Yellow' self.z = 'Green' def do_nothing(self): pass test = dictObj() ...
阅读全文
posted @ 2018-11-19 10:04
anobscureretreat
阅读(3282)
推荐(0)
摘要:
数组,就是相同数据类型的元素按一定顺序排列的集合,可以是一维数组和多维数组 一维数组 实例 输出 实例 输出 多维数组 实例 输出 实例 输出
阅读全文
posted @ 2018-11-19 00:49
anobscureretreat
阅读(949)
推荐(0)
摘要:
打开调试工具,刷新,可以看到脚本被暂停
阅读全文
posted @ 2018-11-19 00:43
anobscureretreat
阅读(170)
推荐(0)
摘要:
字符串或串(String)是由数字、字母、下划线组成的一串字符。 Lua 语言中字符串可以使用以下三种方式来表示: 单引号间的一串字符。 双引号间的一串字符。 [[和]]间的一串字符。 实例 输出
阅读全文
posted @ 2018-11-19 00:42
anobscureretreat
阅读(172)
推荐(0)
摘要:
lua中不能使用nil,特别是#取长度的时候
阅读全文
posted @ 2018-11-19 00:23
anobscureretreat
阅读(189)
推荐(0)
摘要:
-- table.getn(tableName) 得到一个table的大小,等同于操作符# -- 要注意的是:该table的key必须是有序的,索引是从1开始的。 --例如有序的 local xiang = {10,22,34,42,51} print("xiang length ==",table.getn(xiang)) --结果为:[LUA-print] xiang lengt...
阅读全文
posted @ 2018-11-19 00:18
anobscureretreat
阅读(3100)
推荐(0)
摘要:
Lua提供了以下几种运算符类型 算术运算符 关系运算符 逻辑运算符 其他运算符 算术运算符 下表列出了 Lua 语言中的常用算术运算符,设定 A 的值为10,B 的值为 20: 实例 输出 关系运算符 下表列出了 Lua 语言中的常用关系运算符,设定 A 的值为10,B 的值为 20: 实例 我们可
阅读全文
posted @ 2018-11-18 23:37
anobscureretreat
阅读(330)
推荐(0)
摘要:
函数定义 Lua 编程语言函数定义格式 解析: optional_function_scope: 该参数是可选的制定函数是全局函数还是局部函数,未设置该参数默认为全局函数,如果你需要设置函数为局部函数需要使用关键字 local。 function_name: 指定函数名称。 argument1, a
阅读全文
posted @ 2018-11-18 22:23
anobscureretreat
阅读(174)
推荐(0)
摘要:
Lua认为false和nil为假,true和非nil为真。 要注意的是Lua中 0 为 true 输出 实例 输出 实例 输出 if...else 语句 实例 输出 if...elseif...else 语句 语法格式 实例 输出 Lua if 嵌套语句 Lua if 嵌套语句语法格式 实例 输出
阅读全文
posted @ 2018-11-18 20:52
anobscureretreat
阅读(3211)
推荐(0)
摘要:
ipairs 在迭代过程中是会直接跳过所有手动设定key值的变量。pairs不会跳过手动设置key值的变量。 实例 输出 实例 输出 如果遇到手动设置的key并且值为nil,那么pairs和ipairs都会选择跳过该元素 例如: 输出 实例 输出 ipairs在迭代过程中如果遇到nil时会直接停止。
阅读全文
posted @ 2018-11-18 20:02
anobscureretreat
阅读(334)
推荐(0)
摘要:
循环结构是在一定条件下反复执行某段程序的流程结构,被反复执行的程序被称为循环体。 循环语句是由循环体及循环的终止条件两部分组成的 Lua 语言提供了以下几种循环处理方式:while,for,repeat...until,循环的嵌套 while循环 实例 输出: Lua for 循环 Lua 编程语言
阅读全文
posted @ 2018-11-18 18:55
anobscureretreat
阅读(584)
推荐(0)
摘要:
Lua 变量 变量在使用前,必须在代码中进行声明,即创建该变量。编译程序执行代码之前编译器需要知道如何给语句变量开辟存储区,用于存储变量的值。 Lua 变量有三种类型:全局变量、局部变量、表中的域。 Lua 中的变量全是全局变量,那怕是语句块或是函数里,除非用 local 显式声明为局部变量。 局部
阅读全文
posted @ 2018-11-18 17:13
anobscureretreat
阅读(184)
推荐(0)
摘要:
> type(X) nil > type(X)==nil false > type(X)=="nil" true >
阅读全文
posted @ 2018-11-18 15:46
anobscureretreat
阅读(319)
推荐(0)
摘要:
Lua中有8个基本类型分别为:nil、boolean、number、string、userdata、function、thread和table。 nil(空) nil 类型表示没有任何有效值,它只有一个值 -- nil,例如打印一个没有赋值的变量,便会输出一个 nil 值 nil 作比较时应该加上双
阅读全文
posted @ 2018-11-18 15:45
anobscureretreat
阅读(299)
推荐(0)
posted @ 2018-11-18 15:45
anobscureretreat
阅读(394)
推荐(0)
摘要:
单行注释 两个减号是单行注释: -- 多行注释 --[[ 多行注释 多行注释 --]]或者--[=[注释内容]=]
阅读全文
posted @ 2018-11-18 15:35
anobscureretreat
阅读(183)
推荐(0)
摘要:
一.重启系统,按住shift键直到出现GUN GRUB界面(下图) 选择advanced options,按回车 然后移动选择到recovery mode ,接着按下e,不要按回车,因为我们要进入可写模式 然后在用方向键找到Linux 那一行,将ro修改成rw 再按Ctrl+X进入下图界面, 选择r
阅读全文
posted @ 2018-11-18 02:56
anobscureretreat
阅读(579)
推荐(0)
摘要:
lua下载地址:https://www.lua.org/download.html 缺少libreadline-dev依赖包 再次运行 就会通过了 然后安装 接下来我们创建一个 helloworld.lua 文件,代码如下: 运行该文件 输出为:
阅读全文
posted @ 2018-11-18 02:34
anobscureretreat
阅读(308)
推荐(0)