Python之路Day2
-->the start
养成好习惯,每次上课的内容都要写好笔记。
第二天内容主要是熟悉int、long、float、str、list、dict、tuple这几个类的内建方法。
对于Python来说,一切事物都是对象,对象是基于类创建的。
一、整型
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Q1mi"
"""
int类的几个内建方法
"""
# 返回商和余数的元祖
all_pages = 95
per_page = 10
pages = all_pages.__divmod__(per_page)
print(pages)
# __ceil__ ??
num = 19
print(num.__ceil__())
# 绝对值
num1 = -19
print(abs(num1))
print(num1.__abs__())
# 相加
num2 = 5
print(num1+num2)
print(num2.__add__(num1))
# 布尔值,非零返回真,
num3 = 0
print(num2.__bool__())
print(num3.__bool__())
# 判断是是否相等
print(num3.__eq__(num2))
# 返回浮点
print(num2.__float__())
# 地板除 19//5
print(num.__floordiv__(num2))
# 大于等于
print(num.__ge__(num2))
# 大于
print(num.__gt__(num2))
# 哈希
print(num.__hash__())
# __index__ :索引 用于切片,数字无意义
# x[y: z] <==> x[y.__index__(): z.__index__()]
# __init__ :构造方法
# 转换为整数
# x.__int__() <==> int(x)
# __invert__ :取反 x.__invert__() <==> ~x
print(num.__invert__())
# 小于等于
print(num.__le__(num2))
# 小于
print(num.__lt__(num2))
# __lshift__ :左移位
int_temp1 = 1
int_temp2 = 4
print(int_temp1.__lshift__(int_temp2))
# 求模 x.__mod__(y) <==> x%y
print(num.__mod__(num2))
# 相乘 x.__mul__(y) <==> x*y
print(num.__mul__(num2))
# 取反
print(num.__neg__())
# 不等于
print(num.__ne__(num2))
# 取正数 ???
print(num1.__pos__())
# 乘方
print(num.__pow__(2))
# 右加(以下前缀为r的都是右;前缀为l的都是左)
print(num.__radd__(num1))
# 右或
print(int_temp1.__rand__(int_temp2))
# 右除以左,返回商和余数
print(per_page.__rdivmod__(all_pages))
# 转换为解释器可读取的形式
print(num.__repr__())
# 转换为字符串
print(num.__str__())
print(type(num.__str__()))
# 求差 x.__sub__(y) <==> x-y
print(num.__sub__(num2))
# x.__truediv__(y) <==> x/y
print(num.__truediv__(num2))
# 异或 :按位不一样的为真,一样的为假。x.__xor__(y) <==> x^y
# 返回->表示该数字时占用的最少位数
print(bin(37))
print((37).bit_length())
# 返回->共轭数
int_temp1 = 37
print(int_temp1.conjugate())
'''这俩方法暂时没搞懂。。。
def from_bytes(cls, bytes, byteorder, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
"""
int.from_bytes(bytes, byteorder, *, signed=False) -> int
Return the integer represented by the given array of bytes.
The bytes argument must be a bytes-like object (e.g. bytes or bytearray).
The byteorder argument determines the byte order used to represent the
integer. If byteorder is 'big', the most significant byte is at the
beginning of the byte array. If byteorder is 'little', the most
significant byte is at the end of the byte array. To request the native
byte order of the host system, use `sys.byteorder' as the byte order value.
The signed keyword-only argument indicates whether two's complement is
used to represent the integer.
"""
pass
def to_bytes(self, length, byteorder, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__
"""
int.to_bytes(length, byteorder, *, signed=False) -> bytes
Return an array of bytes representing an integer.
The integer is represented using length bytes. An OverflowError is
raised if the integer is not representable with the given number of
bytes.
The byteorder argument determines the byte order used to represent the
integer. If byteorder is 'big', the most significant byte is at the
beginning of the byte array. If byteorder is 'little', the most
significant byte is at the end of the byte array. To request the native
byte order of the host system, use `sys.byteorder' as the byte order value.
The signed keyword-only argument determines whether two's complement is
used to represent the integer. If signed is False and a negative integer
is given, an OverflowError is raised.
"""
pass
'''
int
二、长整型
三、浮点型
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Q1mi"
"""
float的内建方法
"""
# 返回分子分母数构成的元祖
f1 = 10.0
f2 = 0.0
f3 = -0.25
print(f1.as_integer_ratio())
print(f2.as_integer_ratio())
print(f3.as_integer_ratio())
print(f3.as_integer_ratio())
# 返回共轭复数 conjugate(self, *args, ***kwargs)
# 将十六进制数转换为浮点数
print(float.fromhex('0x1.ffffp10'))
# 将浮点数转换为十六进制数
print(2047.984375.hex())
# 判断浮点数是不是整数
f1 = 10.2
f2 = 10.0
print(f1.is_integer())
print(f2.is_integer())
float
四、字符串
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Q1mi"
"""
str类的内建方法练习
"""
name1 = 'alex'
name2 = str('ERIC') # 调用字符串类的__init__()方法
print(type(name1))
print(dir(name1)) # 打印出类的成员
# 包含
result = name1.__contains__('ex')
print(result)
result = 'ex' in name1
print(result)
# 等于
print(name1.__eq__(name2))
# 字符串按照format_spec格式化
"""
format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]
fill ::= <any character>
align ::= "<" | ">" | "=" | "^"
sign ::= "+" | "-" | " "
width ::= integer
precision ::= integer
type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
fill是表示可以填写任何字符。
align是对齐方式,<是左对齐, >是右对齐,^是居中对齐。
sign是符号, +表示正号, -表示负号。
width是数字宽度,表示总共输出多少位数字。
precision是小数保留位数。
type是输出数字值是的表示方式,比如b是二进制表示;比如E是指数表示;比如X是十六进制表示。
"""
# 共20个字符,name1右对齐
print(name1.__format__('>20'))
# 返回小写
result = name2.casefold()
print(result)
# 居中
# print('*' * 8 %s '*' * 8 % name1)
result = name1.center(20, '*')
print(result)
# 获取指定标签属性的值
print(name1.__getattribute__('index'))
# x.__getitem__(y) <==> x[y](返回str[key])
print(name1.__getitem__(1))
# 大于等于
print(name1.__ge__(name2))
# 大于
print(name1.__gt__(name2))
# 哈希
print(name1.__hash__())
# 返回一个字符串的迭代
for i in name1.__iter__():
print(i)
# 返回字符串的长度
print(name1.__len__())
# 首字母大写
print(name1.capitalize())
# 返回将小写字符串转换为大写,大写转换为小写
name3 = "AlEx"
print(name1.swapcase())
print(name2.swapcase())
print(name3.swapcase())
# 返回str的小写
print(name2.casefold())
# 将字符串转换为标题:每个单词的首字母大写
str_temp = "eric is humor!"
print(str_temp.title())
# 居中 下例为:20个字符的宽度以'*'号填充,name1居中
print(name1.center(20, '*'))
# count 计数
str1 = 'adasafafdsfqadasddfa'
result = str1.count('a')
print(result)
# encode 编码
result = name1.encode('gbk')
print(result)
# endswith 以'xxx'结束,后面可跟索引
result = str1.endswith('a')
print(result)
result = str1.endswith('s', 2, 4)
print(result)
# 替换tabs tabsize默认为8
name_temp = 'a\nlex'
print(name_temp.expandtabs())
print(len(name_temp.expandtabs()))
# 查找 返回索引值
print(name1.find('e'))
# 格式化
str_temp = '{} is humor!'
print(str_temp.format(name2))
# 按映射格式化
# format_map(self, mapping)
# 返回索引值 index(self, sub, start=None, end=None) 没有返回0
print(name1.index('l'))
str_temp = 'a1b2c3'
# 判断字符串是否是字母或数字
print(str_temp.isalnum())
# 判断字符串是否只是字母
print(str_temp.isalpha())
# 判断字符串中是否只包含十进制字符
str_temp = '0.3a0.4b'
str_temp1 = '0.3'
print(str_temp.isdecimal())
print(str_temp1.isdecimal())
# 判断字符串中是否只有数字
str_temp = b'
str_temp1 = '
str_temp2 = '四'
print(str_temp.isdigit())
print(str_temp1.isdigit())
print(str_temp2.isdigit())
print("line:148".center(20, "="))
# 判断是否是标识符
str_temp = 'class'
print(str_temp.isidentifier())
# 判断字符串中是否都是小写
str_temp = 'eric'
str_temp1 = 'Eric'
print(str_temp.islower())
print(str_temp1.islower())
# 判断字符串中是否都是数值型字符串
# 'bytes' object has no attribute 'isnumeric'
str_temp = '
str_temp1 = '
str_temp2 = '四'
str_temp3 = '壹佰贰拾叁'
print(str_temp.isnumeric())
print(str_temp1.isnumeric())
print(str_temp2.isnumeric())
print(str_temp3.isnumeric())
# 判断是否可被打印
str_temp = 'abc'
print(str_temp.isprintable())
# 是否为空格
str_temp = ' '
print(str_temp.isspace())
# 判断是否为标题 (所有首字母大写)
str_temp = 'eric is humor!'
str_temp1 = 'Eric Is Humor!'
print(str_temp.istitle())
print(str_temp1.istitle())
print('line:185'.center(20, '='))
# 判断字符串是否全为大写
str_temp = 'eric is humor!'
str_temp1 = 'Eric Is Humor!'
str_temp2 = 'ERIC IS HUMOR!'
print(str_temp.isupper())
print(str_temp1.isupper())
print(str_temp2.isupper())
# 字符串的拼接 join(self, iterable)
str_temp = "ERIC"
print(':'.join(str_temp))
# 左对齐
str_temp = "eric"
print(str_temp.ljust(20, '*'))
# 右对齐
print(str_temp.rjust(20, '*'))
# 将字符串转换为小写
str_temp = "ERIC"
print(str_temp.lower())
# 将字符串转换为大写
str_temp1 = "eric"
print(str_temp1.upper())
# strip()移除字符串前后的指定字符;lstrip()移除左边指定字符 默认为移除空格;rstrip()移除右边指定字符
str_temp = " eric is humor ! "
print(str_temp.strip())
print(str_temp.lstrip())
print(str_temp.rstrip())
str_temp1 = "eric is humor!"
print(str_temp1.lstrip('eric'))
print(str_temp1.rstrip('mor!'))
# maketrans(self, *args, **kwargs)和translate()
str_temp = '
map_temp = str.maketrans(', 'abc')
map_temp1 = str.maketrans(')
print(str_temp.translate(map_temp))
print(str_temp.translate(map_temp1))
# 按照指定分隔符将字符串分割,返回元祖
# 如果字符串包含指定的分隔符,则返回一个三元的元组,第一个为分隔符左边的子串,第二个为分隔符本身,第三个为分隔符右边的子串。
# 如果字符串不包含指定的分隔符,则返回一个三元的元祖,第一个为字符串本身,第二个、第三个为空字符串。
str_temp = "www.google.com"
print(str_temp.partition('google'))
print(str_temp.partition('www'))
print(str_temp.partition('wxw'))
# 右侧开始分隔
print(str_temp.partition('o'))
print(str_temp.rpartition('o'))
# Python replace() 方法把字符串中的 old(旧字符串) 替换成 new(新字符串),如果指定第三个参数max,则替换不超过 max 次。
str_temp = "www.google.com"
print(str_temp.replace('.', '-', 1))
# 右查找
str_temp.rfind('.')
# 右索引
str_temp.rindex('.')
# 分割
str_temp = "www.google.com"
print(str_temp.split('o', 2))
# 右分隔
print(str_temp.rsplit('o', 2))
print('line:252'.center(20, '='))
# 行分割
str_temp = """
eric
is
humor
!
"""
print(str_temp.splitlines())
# 以什么开始
str_temp = "eric is humor!"
print(str_temp.startswith('eric'))
# 返回指定长度的字符串,原字符串右对齐,前面补0
str_temp = "
print(str_temp.zfill(20))
str
五、列表
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Q1mi"
"""
dict类的内建方法
"""
# 增加 :append object to end
l1 = list([1, 2, 3, ])
l1.append(4)
print(l1)
l1.append([5, 6, 7,])
print(l1)
# 清空
print(l1.clear())
# 复制
l1 = [1, 2, 3, ]
print(l1.copy())
# 计数
l1 = [1, 1, 2, 1, 3, 2]
print(l1.count(1))
# 扩展 : extend(self, iterable)
l1 = [1, 2, 3, ]
l1.extend((5, 6, ))
print(l1)
l1.extend('abc')
print(l1)
# 索引
print(l1.index(3))
# 插入:index(self, value, start=None, stop=None)
l1.insert(5, 0)
print(l1)
# 弹出 : pop(self, index=None)
print(l1.pop())
print(l1.pop(5)) # 返回l1[5]
# 移除 :remove(self, value)
l1 = [1, 2, 3, 4, 5, 6, 'a']
l1.remove(6)
print(l1)
print(l1.remove('a')) # 返回None
print(l1)
print('line:51'.center(20, '='))
# 反转
l1 = [1, 2, 3, 4, 5, ]
l1.reverse()
print(l1)
# 排序 :sort(self, key=None, reverse=False)
l1 = [', 'uvw', '哈哈']
l1.sort()
print(l1)
l1.sort(reverse=True)
print(l1)
list
六、字典
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Q1mi"
"""
dict内建的方法
* 字典是无序的
* from collections import OrderedDict # 有序字典
"""
dic1 = {'k1': 'v1', 'k2': 'v2', }
print(dic1)
dic1 = dict(k1='v1', k2='v2')
print(dic1)
# 清空
dic1.clear()
print(dic1)
# 复制 copy()分为深拷贝和浅拷贝 此处为浅拷贝(shallow copy)
# fromkeys: Returns a new dict with keys from iterable and values equal to value.
dic2 = dict.fromkeys(['k1', 'k2', ], 1)
print(dic2)
# 取得指定键的值-> get(self, k, d=None)
dic1 = {'k1': 'v1', 'k2': 'v2'}
print(dic1.get('k1'))
print(dic1.get('k3', 'No!!!'))
# 键值对的集合:items()
print(dic1.items())
for i in dic1.items():
print(i)
# 键值
print(dic1.keys())
for i in dic1.keys():
print(i)
print('line:39'.center(20, '='))
# 弹出: 移除指定的键,返回对应的值 -> pop(self, k, d=None)
print(dic1.pop('k1'))
print(dic1)
print(dic1.pop('k3', 'ERROR!!!'))
# popitem() 弹出一个键值对组成的元祖,字典为空弹出时报错
dic1 = {'k1': 'v1', 'k2': 'v2'}
print(dic1.popitem())
print(dic1)
print(dic1.popitem())
# 为字典设置默认值
dic1 = {}
dic1.setdefault('k1', 'v1')
dic1.setdefault('k2')
print(dic1)
# 升级字典
dic1 = {'k1': 'v1', }
dic2 = {'k2': 'v2', 'k3': 'v3', }
dic1.update(dic2)
print(dic1)
print(dic2)
# 返回字典的值
dic1 = {'k1': 'v1', 'k2': 'v2', 'k3': 'v3', }
print(dic1.values())
for i in dic1.values():
print(i)
# 课堂小练习
# [11, 22, 33, 44, 55, 66, 77, 88, 99, ...]大于66的保存在字典的第一个key的值中,小于等于66的放到第二个key的值中
# {'key1':大于66的, 'key2':小于等于66的}
l1 = [11, 22, 33, 44, 55, 66, 77, 88, 90, 99, ]
dic = {}
for i in l1:
if i > 66:
if 'key1' in dic.keys():
dic['key1'].append(i)
else:
dic['key1'] = [i, ]
else:
if 'key2' in dic.keys():
dic['key2'].append(i)
else:
dic['key2'] = [i, ]
print(dic)
dict
七、元祖
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Q1mi"
"""
tuple的内建方法
* -元祖的元素不可变
* -元祖的元素的元素可以变
"""
# 计数
t1 = (1, 1, 2, 3, 4, 4, 1)
print(t1.count(1))
# 索引
print(t1.index(2))
print('line:18'.center(20, '='))
t1 = (1, 2, {'k1': 'v1'})
t1[2]['k1'] = 2
print(t1)
print(t1[2])
tuple
八、集合
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Q1mi"
"""
集合(set)的内建功能练习
集合(set)是一个无序且不重复的元素的集合。
"""
s1 = set((1, 2, 3, 3))
print(s1)
# add(self, *args, **kwargs) 给集合添加一个新的元素
s1.add(4)
s1.add((4, 5))
print(s1)
# clear(self, *args, **kwargs) 移除集合内的所有元素
s1.clear()
print(s1)
# copy 返回一个集合的浅拷贝
s1 = {1, 2, 3}
s2 = s1.copy()
print(s2)
# difference() 返回两个或多个集合之间不同的元素的集合
s1 = {1, 2, 3}
s2 = {1, 3, 5}
s4 = {2, 4, 6, 8}
s3 = s1.difference(s2) # 把s1里有的,s2里没有的返回给s3
s5 = s4.difference(s1) # 把s4里有的,s1里没有的返回给s5
s = "s1:{0}\ns2:{1}\ns3:{2}\ns4:{3}"
print(s.format(s1, s2, s3, s5))
# difference_update() # 从集合里移除另一个集合里的所有元素
s4.difference_update(s1) # 从s4里面移除s1里也有的所有元素
print(s4)
# discard() 移除集合里的一个元素,如果给的参数不是集合里的元素,则什么都不做
s4.discard(2)
print(s4)
s4.discard(4)
print(s4)
# intersection() 返回两个集合的交集的集合
s1 = {1, 2, 3}
s2 = {1, 3, 5}
s3 = s1.intersection(s2)
print(s3)
print('line:52'.center(20, '*'))
# intersection_update() sa.intersection_update(sb):用sa和sb的交集返回给sa
s1 = {1, 2, 3}
s2 = {1, 3, 5}
s1.intersection_update(s2)
print(s1)
# isdisjoint() # 判断两个集合有无交集,无交集返回True
s1 = {1, 2, 3}
s2 = {1, 3, 5}
s3 = {2, 4, 6}
print(s1.isdisjoint(s2))
print(s2.isdisjoint(s3))
# issubset() sa.issubset(sb):判断sa是否为sb的子集
s1 = {1, 3, 5}
s2 = {1, 3}
print(s2.issubset(s1))
# issuperset sa.issuperset(sb):判断sa是否包含sb
print(s1.issuperset(s2))
# pop() 移除并返回一个任意元素,集合为空时会raise KeyError
s1 = {1, 3, 5}
print(s1.pop())
print(s1)
# remove() 从集合中移除一个元素,没有此元素时,raise KeyError
s1 = {1, 3, 5}
s1.remove(3)
print(s1)
print('line:84'.center(30, '*'))
# symmetric_difference() 返回两个集合的非交集元素到一个新集合
s1 = {1, 2, 5}
s2 = {1, 3, 5, 7}
s3 = s1.symmetric_difference(s2)
print(s3)
# symmetric_difference_update() sa.symmetric_difference_update(sb):将sa、sb的非交集元素返回给sa
s1 = {1, 2, 5}
s2 = {1, 3, 5, 7}
s1.symmetric_difference_update(s2)
print(s1)
# union() sa.union(sb):返回sa、sb的合集
s1 = {1, 2, 3}
s2 = {1, 3, 5}
s3 = s1.union(s2)
print(s3)
# update() sa.update(sb):将sa、sb的合集返回给sa
s1 = {1, 3, 5}
s2 = {2, 4, 6}
s1.update(s2)
print(s1)
集合
集合应用举例:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Q1mi"
"""
集合介绍
"""
# 示例
old_dict = {
"#1": {'hostname': 'c1', 'cpu_count': 2, 'mem_capacity': 80},
"#2": {'hostname': 'c1', 'cpu_count': 2, 'mem_capacity': 80},
"#3": {'hostname': 'c1', 'cpu_count': 2, 'mem_capacity': 80},
}
new_dict = {
"#1": {'hostname': 'c1', 'cpu_count': 2, 'mem_capacity': 800},
"#3": {'hostname': 'c1', 'cpu_count': 2, 'mem_capacity': 80},
"#4": {'hostname': 'c2', 'cpu_count': 2, 'mem_capacity': 80},
}
# 旧字典没有新字典有的就是需要删除的数据
# 旧字典有新字典没有的就是需要增加的数据
# 旧字典和新字典都有的就是(可能)需要更新的数据
# 该示例主要是字典的第一层key为例:
# 将旧字典的第一层key转换成集合
set_old = set(old_dict.keys())
# 将新字典的第一层key转换成集合
set_new = set(new_dict.keys())
# 需要更新的数据就是取新、旧集合的交集
update_list = list(set_old.intersection(set_new))
# 需要删除的数据就是取旧集合与新集合的不同
delete_list = list(set_old.difference(set_new))
# 需要增加的数据就是取新集合与旧集合的不同
add_list = list(set_new.difference(set_old))
s_tmp = 'update_list:{0}\ndelete_list:{1}\nadd_list:{2}'
print(s_tmp.format(update_list, delete_list, add_list))
集合应用示例
<-- the end
Python之路Day2的更多相关文章
- Python之路,Day2 - Python基础(转载Alex)
Day2-转自金角大王 本节内容 列表.元组操作 字符串操作 字典操作 集合操作 文件操作 字符编码与转码 1. 列表.元组操作 列表是我们最以后最常用的数据类型之一,通过列表可以对数据实现最方便的存 ...
- Python之路,Day2 - Python基础2
def decode(self, encoding=None, errors=None): """ 解码 """ ""& ...
- Python之路 day2 字符编码及转换
#!/usr/bin/env python # -*- coding:utf-8 -*- #Author:ersa import sys print("sys default encodin ...
- Python之路 day2 文件基础操作
#!/usr/bin/env python # -*- coding:utf-8 -*- #Author:ersa ''' #f,文件句柄;模式 a : append 追加文件内容 f = open( ...
- Python之路 day2 集合的基本操作
#!/usr/bin/env python # -*- coding:utf-8 -*- #Author:ersa ''' #集合是无序的 集合的关系测试, 增加,删除,查找等操作 ''' #列表去重 ...
- Python之路 day2 按行读文件
#1. 最基本的读文件方法: # File: readline-example-1.py file = open("sample.txt") while 1: line = fil ...
- Python之路 day2 购物车小程序1
#Author:ersa ''' 程序:购物车程序 需求: 启动程序后,让用户输入工资,然后打印商品列表 允许用户根据商品编号购买商品 用户选择商品后,检测余额是否够,够就直接扣款,不够就提醒 可随时 ...
- 小白的Python之路 day2 文件操作
文件操作 对文件操作流程 打开文件,得到文件句柄并赋值给一个变量 通过句柄对文件进行操作 关闭文件 现有文件如下 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 ...
- Python之路,Day2 - Python基础,列表,循环
1.列表练习name0 = 'wuchao'name1 = 'jinxin'name2 = 'xiaohu'name3 = 'sanpang'name4 = 'ligang' names = &quo ...
随机推荐
- JavaScript之获取和设置元素属性
1.与我前面的随笔获取元素的那些方法不同http://www.cnblogs.com/GreenLeaves/p/5689075.html 获取元素属性的方法getAttribute()不属于docu ...
- Unity3D嵌入WPF教程
Unity3D嵌入WPF教程 创建一个 类库工程 添加 WindowForm 用户控件 (UserControl) 1).引入 UntiyWebPlayer COM 组件 在工具->选择工具箱中 ...
- C++_基础_继承、多态
内容: (1)子类中的拷贝构造和拷贝赋值 (2)多继承和虚继承 (3)多态的初识 (4)虚析构的特性和使用 (5)多态的底层实现 (6)纯虚函数.抽象类的概念 1.子类中的拷贝构造和拷贝赋值 子类中的 ...
- 我用过的Linux命令之chmod
chmod命令用于改变linux系统文件或目录的访问权限.用它控制文件或目录的访问权限.该命令有两种用法.一种是包含字母和操作符表达式的文字设定法:另一种是包含数字的数字设定法. Linux系统中的每 ...
- Spring学习之Jar包功能介绍(转)
spring.jar 是包含有完整发布模块的单个jar 包.但是不包括mock.jar, aspects.jar, spring-portlet.jar, and spring-hibernate2. ...
- Mysql 如何做双机热备和负载均衡 (方法一)
MySQL数据库没有增量备份的机制,但它提供了一种主从备份的机制,就是把主数据库的所有的数据同时写到备份数据库中.实现MySQL数据库的热备份. 下面是具体的主从热备份的步骤:假设主服务器A(mast ...
- JAVA之GUI编程窗体事件
package GUI; import java.awt.Button;import java.awt.FlowLayout;import java.awt.Frame;import java.awt ...
- 以正方教务系统为例,用php模拟登陆抓取课表、空教室
课程格子和超级课程表这两个应用,想必大学生都很熟悉,使用自己的学号和教务系统的密码,就可以将自己的课表导入,随时随地都可以在手机上查看. 其实稍微了解一点php的话,我们也可以做一个类似这样的web ...
- ndk 编译 boost 库,支持serialization
Boost库是一个可移植.提供源代码的C++库,作为标准库的后备,是C++标准化进程的开发引擎之一. Boost库由C++标准委员会库工作组成员发起,其中有些内容有望成为下一代C++标准库内容.在C+ ...
- 【LeetCode题意分析&解答】37. Sudoku Solver
Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by th ...