摘要:
Math类中提供了三个与取整有关的方法:ceil,floor,round,这些方法的作用于它们的英文名称的含义相对应 1、ceil的英文意义是天花板,该方法就表示向上取整,Math.ceil(11.3)的结果为12,Math.ceil(-11.6)的结果为-11; 2、floor的英文是地板,该方法
阅读全文
posted @ 2018-12-26 10:50
anobscureretreat
阅读(1145)
推荐(0)
摘要:
ceil(x) 官方含义:对一个数进行上舍入。理解:ceiling为天花板的意思,意译为向上取整。即取得大于于等于x的最大整数。 floor(x) 官方含义:对一个数进行下舍入。理解:floor为地板的意思,意译为向下取整。即取得小于等于x的最大整数。 round() 官方含义: 把一个数四舍五入为
阅读全文
posted @ 2018-12-26 10:32
anobscureretreat
阅读(526)
推荐(0)
摘要:
w4G-in5u3SH75RoB3VZIX8htiZgw4ELilwvPcHAIQWfwfXv5n0IHDp5hv 1BM3+H1XygMtiE0-JBgacjE9tz33sIh542EmsGs1yg638UxVfmWqNLqu- Zw91XxNEiZF7DC7-iV1XbSfsgxI8Tvqr-ZMTxlGCJU+2YLveAc-YXs8ci RTtssts7leEbJ979H5v+G0s...
阅读全文
posted @ 2018-12-25 11:10
anobscureretreat
阅读(3245)
推荐(0)
摘要:
def is_Power_of_four(n): while n and not (n & 0b11): n >>= 2 return (n == 1) print(is_Power_of_four(4)) print(is_Power_of_four(12)) print(is_Power_of_four(16)) print(...
阅读全文
posted @ 2018-12-25 10:23
anobscureretreat
阅读(512)
推荐(0)
posted @ 2018-12-25 01:57
anobscureretreat
阅读(151)
推荐(0)
posted @ 2018-12-22 17:36
anobscureretreat
阅读(3621)
推荐(0)
摘要:
存放一个字型数据(16位)的内存单元,由两个地址连续的内存单元组成。 高地址内存单元中存放字型数据的高位字节,低地址内存单元中存放字型数据的低位字节。 比如一个字单元由2,3两个内存单元组成,则这个字单元的起始地址为2,我们可以说这是2地址字单元。 任何两个地址连续的内存单元,N号单元和N+1号单元
阅读全文
posted @ 2018-12-21 00:19
anobscureretreat
阅读(598)
推荐(0)
摘要:
As it turns out, there is a string method named find that is remarkably similar to the function we wrote: >>> word = 'banana' >>> index = word.find('a
阅读全文
posted @ 2018-12-18 12:45
anobscureretreat
阅读(569)
推荐(0)
摘要:
>>> import os >>> cwd = os.getcwd() >>> cwd '/home/dinsdale' cwd stands for “current working directory”. The result in this example is /home/dinsdale, which is the home directory of a user named ...
阅读全文
posted @ 2018-12-18 11:47
anobscureretreat
阅读(153)
推荐(0)
摘要:
import random for i in range(10): x = random.random() print(x) The function randint takes parameters low and high and returns an integer between low and high (including both). >>> random...
阅读全文
posted @ 2018-12-18 11:38
anobscureretreat
阅读(204)
推荐(0)
摘要:
>>> import string >>> string.punctuation '!"#$%&'()*+,-./:;?@[\]^_`{|}~'
阅读全文
posted @ 2018-12-18 11:37
anobscureretreat
阅读(342)
推荐(0)
摘要:
Dictionaries have a method called items that returns a sequence of tuples, where each tuple is a key-value pair. >>> d = {'a':0, 'b':1, 'c':2} >>> t =
阅读全文
posted @ 2018-12-18 11:36
anobscureretreat
阅读(134)
推荐(0)
摘要:
>>> for pair in zip(s, t): ... print(pair) ... ('a', 0) ('b', 1) ('c', 2) If you want to use list operators and methods, you can use a zip object to m
阅读全文
posted @ 2018-12-18 11:22
anobscureretreat
阅读(252)
推荐(0)
摘要:
>>> t1 = [1, 2] >>> t2 = t1.append(3) >>> t1 [1, 2, 3] >>> t2 None
阅读全文
posted @ 2018-12-18 11:15
anobscureretreat
阅读(215)
推荐(0)
摘要:
Because list is the name of a built-in function, you should avoid using it as a variable name. I also avoid l because it looks too much like 1. So tha
阅读全文
posted @ 2018-12-18 11:12
anobscureretreat
阅读(179)
推荐(0)
摘要:
There are several ways to delete elements from a list. If you know the index of the element you want, you can use pop: >>> t = ['a', 'b', 'c'] >>> x = t.pop(1) >>> t ['a', 'c'] >>> x 'b' pop modifi...
阅读全文
posted @ 2018-12-18 11:04
anobscureretreat
阅读(150)
推荐(0)
摘要:
包括, 代码段寄存器cs 数据段寄存器ds 附加段寄存器es 栈段寄存器ss
阅读全文
posted @ 2018-12-18 01:14
anobscureretreat
阅读(287)
推荐(0)
摘要:
长度为16bit 包括:ax,bx,cx,dx,si,di,bp,sp 其中,ax,bx,cx,dx,可以作为8位寄存器使用 ah,al bh,bl ch,cl dh,dl
阅读全文
posted @ 2018-12-18 01:12
anobscureretreat
阅读(600)
推荐(0)
摘要:
最强大的王爽汇编语言学习环境使用教程 一、前言 这是采用VMwere Workstation 12 pro虚拟机软件,搭建的MS-DOS学习环境,在windowsXP/8/10及linux中均可以使用,在这个环境中,我集成了CCDOS中文系统,pdos中文系统,使用这些系统,可以进行中文输入与显示。
阅读全文
posted @ 2018-12-18 01:03
anobscureretreat
阅读(2409)
推荐(0)
摘要:
html: javascript:
阅读全文
posted @ 2018-12-17 18:53
anobscureretreat
阅读(1860)
推荐(0)
摘要:
直接执行这两个命令即可 如果要切换到Python2,执行: 下面按照提示操作即可
阅读全文
posted @ 2018-12-17 14:38
anobscureretreat
阅读(153)
推荐(0)
posted @ 2018-12-17 14:26
anobscureretreat
阅读(151)
推荐(0)
摘要:
https://github.com/postmanlabs/postman-app-support
阅读全文
posted @ 2018-12-17 14:18
anobscureretreat
阅读(1069)
推荐(0)
摘要:
获取get请求里面参数的两种方法之三种写法一,当get网址是127.0.0.1:8000/info/?id=20&s_id=30这种类型的网址时 我们在urls的路由的urlpatterns里面里面这样定义路由 url(r'info/$',views.info),那么我们怎么把参数取出来呢 因为我们
阅读全文
posted @ 2018-12-17 11:57
anobscureretreat
阅读(5552)
推荐(0)
摘要:
每一个圆形就是一个磁道(灰色部分),被半径分割的一个个扇形,就是扇区。 下图显示的是一个盘面,盘面中一圈圈灰色同心圆为一条条磁道,从圆心向外画直线,可以将磁道划分为若干个弧段,每个磁道上一个弧段被称之为一个扇区(图践绿色部分)。扇区是磁盘的最小组成单元,通常是512字节。(由于不断提高磁盘的大小,部
阅读全文
posted @ 2018-12-16 03:27
anobscureretreat
阅读(894)
推荐(0)
摘要:
gzip 和 bz2 模块可以很容易的处理这些文件。 两个模块都为 open() 函数提供了另外的实现来解决这个问题。 比如,为了以文本形式读取压缩文件,可以这样做: # gzip compression import gzip with gzip.open('somefile.gz', 'rt')
阅读全文
posted @ 2018-12-14 20:57
anobscureretreat
阅读(1513)
推荐(0)
摘要:
假设你的包中的文件组织成如下: mypackage/ __init__.py somedata.dat spam.py mypackage/ __init__.py somedata.dat spam.py 现在假设spam.py文件需要读取somedata.dat文件中的内容。你可以用以下代码来完
阅读全文
posted @ 2018-12-14 20:53
anobscureretreat
阅读(566)
推荐(0)
摘要:
将文本的行限制到特定的宽 这个用 echo 命令发送的文本用 -w 选项分解成块。 在这个例子中,我们设定了行宽为12个字符。 如果没有字符设置,默认是80。 增加的 -s 选项将让 fold 分解到最后可用的空白 字符,即会考虑单词边界。 例子 输出 例子 输出
阅读全文
posted @ 2018-12-14 17:06
anobscureretreat
阅读(421)
推荐(0)
摘要:
ln -s 目标名 别名 不论是硬连结或软链结都不会将原本的档案复制一份,只会占用非常少量的磁碟空间。 -f : 链结时先将与 dist 同档名的档案删除 -d : 允许系统管理者硬链结自己的目录 -i : 在删除与 dist 同档名的档案时先进行询问 -n : 在进行软连结时,将 dist 视为一般的档案 -s : 进行软链结(symbolic link) ...
阅读全文
posted @ 2018-12-14 16:15
anobscureretreat
阅读(2517)
推荐(0)
摘要:
class py_solution: def twoSum(self, nums, target): lookup = {} for i, num in enumerate(nums): if target - num in lookup: return (lookup[targ...
阅读全文
posted @ 2018-12-13 10:05
anobscureretreat
阅读(239)
推荐(0)
摘要:
#用递归函数求 n 阶乘的值 def factorial(i): if i==0: return 1 else: return i * factorial(i-1)# sum=n*(n-1)!所以直接调用自身 n=int(input('请输入阶乘数:')) for i in range(n+1): print('%d !值为 %3d...
阅读全文
posted @ 2018-12-13 01:03
anobscureretreat
阅读(2725)
推荐(0)
摘要:
# 用for循环计算 n! sum = 1 n=int(input('请输入n=')) for i in range(0,n+1): for j in range(i,0,-1): sum *= j # sum=sum*j print('%d!=%3d' %(i,sum)) sum=1
阅读全文
posted @ 2018-12-13 00:57
anobscureretreat
阅读(1157)
推荐(0)
posted @ 2018-12-13 00:02
anobscureretreat
阅读(1143)
推荐(0)
摘要:
#include #include #include #include using namespace std; int main() { vector v{1,2,3}; reverse(begin(v), end(v));//反转容器元素顺序 for(auto e : v) cout << e; cout << '\n'; int a...
阅读全文
posted @ 2018-12-12 23:47
anobscureretreat
阅读(1195)
推荐(1)
摘要:
#include #include #include using namespace std; int main( ) { list c{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; for (auto &i : c) { cout ::iterator range_begin = c.begin(); list::iterato...
阅读全文
posted @ 2018-12-12 20:44
anobscureretreat
阅读(5418)
推荐(0)
摘要:
#include #include using namespace std; int main() { list numbers; cout << "Initially, numbers.empty(): " << numbers.empty() << '\n'; numbers.push_back(42); numbers.push_back(...
阅读全文
posted @ 2018-12-12 20:27
anobscureretreat
阅读(2727)
推荐(0)
摘要:
#include #include #include using namespace std; int main() { vector ints {1, 2, 4}; vector fruits {"orange", "apple", "raspberry"}; vector empty; // Sums all integers in the...
阅读全文
posted @ 2018-12-12 20:17
anobscureretreat
阅读(1588)
推荐(0)
posted @ 2018-12-12 14:30
anobscureretreat
阅读(753)
推荐(0)
摘要:
#include #include using namespace std; int main () { vector myvector (25); cout << "1. capacity of myvector: " << myvector.capacity() << '\n'; for (int i=0; i<20; i++) myvector[i]=i; ...
阅读全文
posted @ 2018-12-12 14:21
anobscureretreat
阅读(948)
推荐(0)
摘要:
#include #include using namespace std; int main () { vector myints; cout << "0. size: " << myints.size() << '\n'; for (int i=0; i<10; i++) myints.push_back(i); cout << "1. si...
阅读全文
posted @ 2018-12-12 13:29
anobscureretreat
阅读(2297)
推荐(0)