萌新向Python数据分析及数据挖掘 第二章 pandas 第二节 Python Language Basics, IPython, and Jupyter Notebooks...-程序员宅基地

Python Language Basics, IPython, and Jupyter Notebooks

In [5]:
import numpy as np #导入numpy
np.random.seed(12345)#设定再现的的随机数 np.set_printoptions(precision=4, suppress=True) #设置打印设置 
 

Signature: np.set_printoptions(precision=None, threshold=None, edgeitems=None, linewidth=None, suppress=None, nanstr=None, infstr=None, formatter=None, sign=None, floatmode=None, **kwarg) Docstring: Set printing options.

These options determine the way floating point numbers, arrays and other NumPy objects are displayed.

 

The Python Interpreter

 
$ python
Python 3.6.0 | packaged by conda-forge | (default, Jan 13 2017, 23:17:12) [GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> a = 5 >>> print(a) 5 
 
print('Hello world')
 
$ python hello_world.py
Hello world 
 
$ ipython
Python 3.6.0 | packaged by conda-forge | (default, Jan 13 2017, 23:17:12) Type "copyright", "credits" or "license" for more information. IPython 5.1.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: %run hello_world.py Hello world In [2]: 
 

IPython Basics

 

Running the IPython Shell

 

$

In [6]:
import numpy as np 
data = {
               i : np.random.randn() for i in range(7)} data 
Out[6]:
{0: -0.20470765948471295,
 1: 0.47894333805754824,
 2: -0.5194387150567381,
 3: -0.55573030434749,
 4: 1.9657805725027142,
 5: 1.3934058329729904,
 6: 0.09290787674371767}
 

Return a sample (or samples) from the "standard normal" distribution. 返回7个标准正态分布随机数,存在data字典里 KEY为0-6

 

from numpy.random import randn data = {i : randn() for i in range(7)} print(data) {0: -1.5948255432744511, 1: 0.10569006472787983, 2: 1.972367135977295, 3: 0.15455217573074576, 4: -0.24058577449429575, 5: -1.2904897053651216, 6: 0.3308507317325902}

 

Running the Jupyter Notebook

 
$ jupyter notebook
[I 15:20:52.739 NotebookApp] Serving notebooks from local directory:
/home/wesm/code/pydata-book
[I 15:20:52.739 NotebookApp] 0 active kernels [I 15:20:52.739 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/ [I 15:20:52.740 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). Created new window in existing browser session. 
 

Tab Completion

In [ ]:
按TAB键可以有提示输入功能
 
In [1]: an_apple = 27

In [2]: an_example = 42

In [3]: an
 
In [3]: b = [1, 2, 3]

In [4]: b.
 
In [1]: import datetime

In [2]: datetime.
 
In [7]: datasets/movielens/
 

Introspection

 

问号可以显示相应帮助信息

 
In [8]: b = [1, 2, 3]

In [9]: b?
Type:       list
String Form:[1, 2, 3]
Length:     3
Docstring:
list() -> new empty list
list(iterable) -> new list initialized from iterable's items

In [10]: print?
Docstring:
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)

Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file:  a file-like object (stream); defaults to the current sys.stdout.
sep:   string inserted between values, default a space.
end:   string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.
Type:      builtin_function_or_method
 
def add_numbers(a, b): """  Add two numbers together  Returns  -------  the_sum : type of arguments  """ return a + b 
 
In [11]: add_numbers? Signature: add_numbers(a, b) Docstring: Add two numbers together Returns ------- the_sum : type of arguments File: <ipython-input-9-6a548a216e27> Type: function 
 
In [12]: add_numbers?? Signature: add_numbers(a, b) Source: def add_numbers(a, b): """  Add two numbers together  Returns  -------  the_sum : type of arguments  """ return a + b File: <ipython-input-9-6a548a216e27> Type: function 
 
In [13]: np.*load*? np.__loader__ np.load np.loads np.loadtxt np.pkgload 
In [ ]:
*load*可以搜索numpy顶级命名空间中有load的所有函数
 

The %run Command

 
def f(x, y, z): return (x + y) / z a = 5 b = 6 c = 7.5 result = f(a, b, c) 
 
In [14]: %run ipython_script_test.py 
 
In [15]: c
Out [15]: 7.5 In [16]: result Out[16]: 1.4666666666666666 
 
>>> %load ipython_script_test.py def f(x, y, z): return (x + y) / z a = 5 b = 6 c = 7.5 result = f(a, b, c) 
 
中断运行代码 CTRL+C
 

从剪贴板执行代码

 
x = 5
y = 7 if x > 5: x += 1 y = 8 
 
In [17]: %paste x = 5 y = 7 if x > 5: x += 1 y = 8 ## -- End pasted text -- 
 
In [18]: %cpaste Pasting code; enter '--' alone on the line to stop or use Ctrl-D. :x = 5 :y = 7 :if x > 5: : x += 1 : : y = 8 :-- 
 

Terminal Keyboard Shortcuts

 

 

About Magic Commands

 
In [20]: a = np.random.randn(100, 100) In [20]: %timeit np.dot(a, a) 10000 loops, best of 3: 20.9 µs per loop 
 

魔法命令 计时

 
In [21]: %debug? Docstring: :: %debug [--breakpoint FILE:LINE] [statement [statement ...]] Activate the interactive debugger. This magic command support two ways of activating debugger. One is to activate debugger before executing code. This way, you can set a break point, to step through the code from the point. You can use this mode by giving statements to execute and optionally a breakpoint. The other one is to activate debugger in post-mortem mode. You can activate this mode simply running %debug without any argument. If an exception has just occurred, this lets you inspect its stack frames interactively. Note that this will always work only on the last traceback that occurred, so you must call this quickly after an exception that you wish to inspect has fired, because if another one occurs, it clobbers the previous one. If you want IPython to automatically do this on every exception, see the %pdb magic for more details. positional arguments: statement Code to run in debugger. You can omit this in cell magic mode. optional arguments: --breakpoint <FILE:LINE>, -b <FILE:LINE> Set break point at LINE in FILE. 
 

魔法命令 DEBUG 激活交互式调试器。

这个神奇的命令支持两种激活调试器的方法。 一种是在执行代码之前激活调试器。这样,你 可以设置一个断点,从点开始逐步执行代码。 您可以通过给出要执行的语句来使用此模式 一个断点。

另一个是在事后模式下激活调试器。您可以 激活此模式只需运行%debug而不带任何参数。 如果刚刚发生异常,则可以检查其堆栈 交互式地框架。请注意,这始终只适用于最后一个 发生了回溯,所以你必须在一个之后快速调用它 你希望检查的异常已被解雇,因为如果另一个 发生了,它破坏了前一个。

如果您希望IPython在每个异常上自动执行此操作,请参阅 %pdb magic更多细节。

 
In [22]: %pwd Out[22]: '/home/wesm/code/pydata-book In [23]: foo = %pwd In [24]: foo Out[24]: '/home/wesm/code/pydata-book' 
 

魔法命令 输出路径

 

Matplotlib Integration

 
In [26]: %matplotlib Using matplotlib backend: Qt4Agg 
 
In [26]: %matplotlib inline 
 

让matolotlib显示在notebook中

 

Python Language Basics

 

Language Semantics

 
规定使用缩进表示代码间的逻辑
 
for x in array:
    if x < pivot: less.append(x) else: greater.append(x) 
 
a = 5; b = 6; c = 7 
 
万物皆是对象
 
井号后面一行不执行
 
results = []
for line in file_handle: # keep the empty lines for now # if len(line) == 0: # continue results.append(line.replace('foo', 'bar')) 
 
print("Reached this line")  # Simple status report
 
函数和对象方法调用
 

result = f(x, y, z) g()

 
obj.some_method(x, y, z)
 

对象.公式(参数1,参数2,参数3)

 
result = f(a, b, c, d=5, e='foo') 
 
变量和参数传递
In [8]:
a = [1, 2, 3] 
In [9]:
b = a
In [12]:
a.append(4) b# 4 
Out[12]:
[1, 2, 3, 4]
In [13]:
b.append(5) a 
Out[13]:
[1, 2, 3, 4, 5]
 

自制append

 
def append_element(some_list, element): some_list.append(element) 
 
In [27]: data = [1, 2, 3] In [28]: append_element(data, 4) In [29]: data Out[29]: [1, 2, 3, 4] 
 
Dynamic references, strong types
In [14]:
a = 5
type(a) a = 'foo' type(a) 
Out[14]:
str
In [15]:
'5' + 5
 
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-15-4dd8efb5fac1> in <module>()
----> 1 '5' + 5 TypeError: must be str, not int
In [16]:
a = 4.5
b = 2 # String formatting, to be visited later print('a is {0}, b is {1}'.format(type(a), type(b))) a / b 
 
a is <class 'float'>, b is <class 'int'>
Out[16]:
2.25
In [17]:
a = 5
isinstance(a, int) 
Out[17]:
True
In [18]:
a = 5; b = 4.5 isinstance(a, (int, float)) isinstance(b, (int, float)) 
Out[18]:
True
 
属性和方法
 
In [1]: a = 'foo' In [2]: a.<Tab出现属性和方法提示m> a.capitalize a.format a.isupper a.rindex a.strip a.center a.index a.join a.rjust a.swapcase a.count a.isalnum a.ljust a.rpartition a.title a.decode a.isalpha a.lower a.rsplit a.translate a.encode a.isdigit a.lstrip a.rstrip a.upper a.endswith a.islower a.partition a.split a.zfill a.expandtabs a.isspace a.replace a.splitlines a.find a.istitle a.rfind a.startswith 
In [19]:
a = 'foo'
In [21]:
getattr(a, 'split') 
Out[21]:
<function str.split>
 

Docstring: getattr(object, name[, default]) -> value

Get a named attribute from an object; getattr(x, 'y') is equivalent to x.y. When a default argument is given, it is returned when the attribute doesn't exist; without it, an exception is raised in that case. Type: builtin_function_or_method

 
Duck typing
 

在Python中 鸭子类型在Python中被广泛使用。Python术语表这样定义鸭子类型:

Pythonic programming style that determines an object's type by inspection of its method or attribute signature rather than by explicit relationship to some type object ("If it looks like a duck and quacks like a duck, it must be a duck.") By emphasizing interfaces rather than specific types, well-designed code improves its flexibility by allowing polymorphic substitution. Duck-typing avoids tests using type() or isinstance(). Instead, it typically employs the EAFP (Easier to Ask Forgiveness than Permission) style of programming.

It's easier to ask forgiveness than it is to get permission. Variant: If it's a good idea, go ahead and do it. It is much easier to apologize than it is to get permission.---Grace Hopper - Wikiquote

在Python中,鸭子类型的最典型例子就是类似file的类。这些类可以实现file的一些或全部方法,并可以用于file通常使用的地方。例如,GzipFile实现了一个用于访问gzip压缩的数据的类似file的对象。cStringIO允许把一个Python字符串视作一个文件。套接字(socket)也和文件共同拥有许多相同的方法。然而套接字缺少tell()方法,不能用于GzipFile可以使用的所有地方。这体现了鸭子类型的可伸缩性:一个类似file的对象可以实现它有能力实现的方法,且只能被用于它有意义的情形下。

EAFP原则描述了异常处理的使用。例如相对于检查一个自称为类似Duck的对象是否拥有一个quack()方法(使用if hasattr(mallard, "quack"): ...),人们通常更倾向于用异常处理把对quack的调用尝试包裹起来:

try: mallard.quack() except (AttributeError, TypeError): print "mallard並沒有quack()函式" 这个写法的优势在于它鼓励结构化处理其他来自类的错误(这样的话,例如,一个不能完成quack的Duck子类可以抛出一个“QuackException”,这个异常可以简单地添加到包裹它的代码,并不需要影响更多的代码的逻辑。同时,对于其他不同类的对象存在不兼容的成员而造成的命名冲突,它也能够处理(例如,假设有一个医学专家Mallard有一个布尔属性将他分类为“quack=True”,试图执行Mallard.quack()将抛出一个TypeError)。

在更实际的实现类似file的行为的例子中,人们更倾向于使用Python的异常处理机制来处理各种各样的可能因为各种程序员无法控制的环境和operating system问题而发生的I/O错误。在这里,“鸭子类型”产生的异常可以在它们自己的子句中捕获,与操作系统、I/O和其他可能的错误分别处理,从而避开复杂的检测和错误检查逻辑。

In [22]:
def isiterable(obj):
    try: iter(obj) return True except TypeError: # 不可迭代 return False 
 

Docstring: iter(iterable) -> iterator iter(callable, sentinel) -> iterator

从对象获取迭代器。 In the first form, the argument must supply its own iterator, or be a sequence. In the second form, the callable is called until it returns the sentinel. Type: builtin_function_or_method

In [25]:
isiterable('a string')
Out[25]:
True
In [26]:
isiterable([1, 2, 3]) 
Out[26]:
True
In [27]:
isiterable(5)
Out[27]:
False
 

if not isinstance(x, list) and isiterable(x): x = list(x)

 
导入
 
# some_module.py
PI = 3.14159

def f(x): return x + 2 def g(a, b): return a + b 
 

import some_module result = some_module.f(5) pi = some_module.PI

 

from some_module import f, g, PI result = g(5, PI)

 

import some_module as sm from some_module import PI as pi, g as gf

r1 = sm.f(pi) r2 = gf(6, pi)

 
二元运算符和比较
In [30]:
5 - 7
Out[30]:
-2
In [31]:
12 + 21.5
Out[31]:
33.5
In [32]:
5 <= 2
Out[32]:
False
In [34]:
a = [1, 2, 3] b = a c = list(a) a is b 
Out[34]:
True
In [35]:
a is not c
Out[35]:
True
In [36]:
a == c
Out[36]:
True
In [39]:
a = None
In [40]:
a is None
Out[40]:
True
 
可变和不可变的对象
In [41]:
a_list = ['foo', 2, [4, 5]] a_list[2] = (3, 4) a_list 
Out[41]:
['foo', 2, (3, 4)]
In [43]:
a_tuple = (3, 5, (4, 5))#元组元素不可变 a_tuple[1] = 'four' 
 
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-43-2c9bddc8679c> in <module>()
 1 a_tuple = (3, 5, (4, 5)) ----> 2 a_tuple[1] = 'four' TypeError: 'tuple' object does not support item assignment
In [45]:
a_tuple = (3, 5, [4, 5])#但是元组内的可变对象可以修改 a_tuple[2][0] = 'four' a_tuple 
Out[45]:
(3, 5, ['four', 5])
 

Scalar Types

 
Numeric types
In [46]:
ival = 17239871
ival ** 6 
Out[46]:
26254519291092456596965462913230729701102721
In [47]:
fval = 7.243
fval2 = 6.78e-5 
In [48]:
3 / 2
Out[48]:
1.5
In [49]:
3 // 2  #"//"取整除 - 返回商的整数部分(向下取整)
Out[49]:
1
 
Strings
 

a = 'one way of writing a string' b = "another way"

In [ ]:
c = """
This is a longer string that
spans multiple lines
""" 
In [50]:
c.count('\n')# 换行符在c字符串的计数 
Out[50]:
0
In [54]:
a = 'this is a string'
a[10] = 'f' 
 
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-54-85038afe6a01> in <module>()
 1 a = 'this is a string' ----> 2 a[10] = 'f'  3 b = a.replace('string', 'longer string')  4 b TypeError: 'str' object does not support item assignment
In [55]:
b = a.replace('string', 'longer string') b 
Out[55]:
'this is a longer string'
 

Docstring: S.replace(old, new[, count]) -> str

Return a copy of S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.

In [53]:
a
Out[53]:
'this is a string'
In [57]:
a = 5.6
s = str(a) print(s) print(type(s)) 
 
5.6
<class 'str'>
In [59]:
s = 'python'
l= list(s) s[:3] print(type(l)) print(type(s)) 
 
<class 'list'>
<class 'str'>
 

转义符及raw还原

In [63]:
s = '12\\34'
s1 = '12\34' s2 = r'12\34' print(s) print(s1) print(s2) 
 
12\34
12
12\34
In [62]:
s = r'this\has\no\special\characters'
s
Out[62]:
'this\\has\\no\\special\\characters'
In [ ]:
字符串拼接
In [64]:
a = 'this is the first half '
b = 'and this is the second half' a + b 
Out[64]:
'this is the first half and this is the second half'
 

格式化输出

In [66]:
template = '{0:.2f} {1:s} are worth US${2:d}' 
In [67]:
template.format(4.5560, 'Argentine Pesos', 1) 
Out[67]:
'4.56 Argentine Pesos are worth US$1'
 

S.format(*args, **kwargs) -> str

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces ('{' and '}').

 
Bytes and Unicode
In [71]:
val = "español"
print(val) print(type(val)) 
 
español
<class 'str'>
In [72]:
val_utf8 = val.encode('utf-8') val_utf8 type(val_utf8) 
Out[72]:
bytes
In [73]:
val_utf8.decode('utf-8') 
Out[73]:
'español'
In [ ]:
val.encode('latin1') val.encode('utf-16') val.encode('utf-16le') 
In [74]:
bytes_val = b'this is bytes'
bytes_val
decoded = bytes_val.decode('utf8') decoded # this is str (Unicode) now 
Out[74]:
'this is bytes'
 
Booleans
In [ ]:
True and True
False or True 
 
Type casting
In [77]:
s = '3.14159'
fval = float(s) 
In [78]:
type(fval)
Out[78]:
float
In [79]:
int(fval)
Out[79]:
3
In [80]:
bool(fval)
Out[80]:
True
In [81]:
bool(0)
Out[81]:
False
 
None
In [ ]:
a = None
a is None b = 5 b is not None 
 

def add_and_maybe_multiply(a, b, c=None): result = a + b

if c is not None:
    result = result * c

return result
In [82]:
type(None)
Out[82]:
NoneType
 
Dates and times
In [84]:
from datetime import datetime, date, time dt = datetime(2011, 10, 29, 20, 30, 21) dt.day dt.minute 
Out[84]:
30
 

Init signature: datetime(self, /, *args, **kwargs) Docstring:
datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])

年月日必须。 tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints.

In [86]:
dt.date()
Out[86]:
datetime.time(20, 30, 21)
In [87]:
dt.time()
Out[87]:
datetime.time(20, 30, 21)
In [88]:
dt.strftime('%m/%d/%Y %H:%M') #格式化时间显示 
Out[88]:
'10/29/2011 20:30'
In [89]:
datetime.strptime('20091031', '%Y%m%d') 
Out[89]:
datetime.datetime(2009, 10, 31, 0, 0)
In [90]:
dt.replace(minute=0, second=0) 
Out[90]:
datetime.datetime(2011, 10, 29, 20, 0)
In [95]:
dt2 = datetime(2011, 11, 15, 22, 30) delta = dt2 - dt delta 
Out[95]:
datetime.timedelta(17, 7179)
In [96]:
type(delta)
Out[96]:
datetime.timedelta
 

A duration expressing the difference between two date, time, or datetime instances to microsecond resolution.

In [100]:
dt
dt + delta
Out[100]:
datetime.datetime(2011, 11, 15, 22, 30)
 

Control Flow

 
if, elif, and else
 

if x < 0: print('It's negative')

 

if x < 0: print('It's negative') elif x == 0: print('Equal to zero') elif 0 < x < 5: print('Positive but smaller than 5') else: print('Positive and larger than or equal to 5')

In [101]:
a = 5; b = 7 c = 8; d = 4 if a < b or c > d: print('Made it') 
 
Made it
In [102]:
4 > 3 > 2 > 1 
Out[102]:
True
 
for loops
 

for value in collection:

# do something with value
 

sequence = [1, 2, None, 4, None, 5] total = 0 for value in sequence: if value is None: continue total += value

 

sequence = [1, 2, 0, 4, 6, 5, 2, 1] total_until_5 = 0 for value in sequence: if value == 5: break total_until_5 += value

In [103]:
for i in range(4): for j in range(4): if j > i: break print((i, j)) 
 
(0, 0)
(1, 0)
(1, 1)
(2, 0)
(2, 1)
(2, 2)
(3, 0)
(3, 1)
(3, 2)
(3, 3)
 

Init signature: range(self, /, *args, **kwargs) Docstring:
range(stop) -> range object range(start, stop[, step]) -> range object

Return an object that produces a sequence of integers from start (inclusive) to stop (exclusive) by step. range(i, j) produces i, i+1, i+2, ..., j-1. start defaults to 0, and stop is omitted! range(4) produces 0, 1, 2, 3. These are exactly the valid indices for a list of 4 elements. When step is given, it specifies the increment (or decrement).

 

for a, b, c in iterator:

# do something
 
while loops
 

x = 256 total = 0 while x > 0: if total > 500: break total += x x = x // 2

 
pass
 

if x < 0: print('negative!') elif x == 0:

# TODO: put something smart here
pass

else: print('positive!')

 
range
In [104]:
range(10)
list(range(10)) 
Out[104]:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 

Init signature: list(self, /, *args, **kwargs) Docstring:
list() -> new empty list list(iterable) -> new list initialized from iterable's items

In [ ]:
list(range(0, 20, 2)) list(range(5, 0, -1)) 
 

seq = [1, 2, 3, 4] for i in range(len(seq)): val = seq[i]

 

sum = 0 for i in range(100000):

# % is the modulo operator
if i % 3 == 0 or i % 5 == 0:
    sum += i
 
Ternary expressions
 

value =

 

if

In [ ]:
x = 5
'Non-negative' if x >= 0 else 'Negative'

转载于:https://www.cnblogs.com/romannista/p/10661392.html

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_30920597/article/details/95936136

智能推荐

在ubuntu 8.04下安装Oracle 11g二-程序员宅基地

文章浏览阅读408次。 在ubuntu 8.04下安装Oracle 11g2008年05月22日 星期四 11:02oracle 11g 数据库虽然提供了linux x86的版本,但是支持的linux版本只有Red Hat,Novell and Solaris 这几个,debian 和 ubuntu 不在支持之列,所以在ubuntu下安装就相对麻烦一些,请照着下文的方法一步一步的安装,不

初一计算机知识点下册,初一英语下册语法知识点全汇总-程序员宅基地

文章浏览阅读166次。新东方在线中考网整理了《初一英语下册语法知识点全汇总》,供同学们参考。一. 情态动词can的用法can+动词原形,它不随主语的人称和数而变化。1. 含有can的肯定句:主语+can+谓语动词的原形+其他。2. 含有can的否定句:主语+can't+动词的原形+其他。3. 变一般疑问句时,把can提前:Can+主语+动词原形+其他? 肯定回答:Yes,主语+can。否定回答:No,主语+can't...._七年级下册计算机知识点

NX/UG二次开发—其他—UFUN函数调用Grip程序_uf调用grip-程序员宅基地

文章浏览阅读3k次。在平时开发中,可能会遇到UFUN函数没有的功能,比如创建PTP的加工程序(我目前没找到,哪位大神可以指点一下),可以使用Grip创建PTP,然后用UFUN函数UF_call_grip调用Grip程序。具体如下截图(左侧UFUN,右侧Grip程序):..._uf调用grip

Android RatingBar的基本使用和自定义样式,kotlin中文教程_ratingbar样式修改-程序员宅基地

文章浏览阅读156次。第一个:原生普通样式(随着主题不同,样式会变)第二个:原生普通样式-小icon第三个:自定义RatingBar 颜色第四个:自定义RatingBar DrawableRatingBar 各样式实现===============原生样式原生样式其实没什么好说的,使用系统提供的style 即可<RatingBarstyle="?android:attr/ratingBarStyleIndicator"android:layout_width=“wrap_cont.._ratingbar样式修改

OpenGL环境搭建:vs2017+glfw3.2.1+glad4.5_vs2017的opengl环境搭建(完整篇)-程序员宅基地

文章浏览阅读4.6k次,点赞6次,收藏11次。安装vs2017:参考vs2017下载和安装。安装cmake3.12.3:cmake是一个工程文件生成工具。用户可以使用预定义好的cmake脚本,根据自己的选择(像是Visual Studio, Code::Blocks, Eclipse)生成不同IDE的工程文件。可以从它官方网站的下载页上获取。这里我选择的是Win32安装程序,如图所示:然后就是运行安装程序进行安装就行。配置glfw3...._vs2017的opengl环境搭建(完整篇)

在linux-4.19.78中使用UBIFS_ubifs warning-程序员宅基地

文章浏览阅读976次。MLC NAND,UBIFS_ubifs warning

随便推点

计算机系统内存储器介绍,计算机系统的两种存储器形式介绍-程序员宅基地

文章浏览阅读2.2k次。计算机系统的两种存储器形式介绍时间:2016-1-6计算机系统的存储器一般应包括两个部分;一个是包含在计算机主机中的主存储器,简称内存,它直接和运算器,控制器及输入输出设备联系,容量小,但存取速度快,一般只存放那些急需要处理的数据或正在运行的程序;另一个是包含在外设中的外存储器,简称外存,它间接和运算器,控制器联系,存取速度虽然慢,但存储容量大,是用来存放大量暂时还不用的数据和程序,一旦要用时,就..._计算机存储器系统采用的是主辅结构,主存速度快、容量相对较小,用于 1 分 程序,外

西门子PLC的编程工具是什么?_西门子plc编程软件-程序员宅基地

文章浏览阅读5.6k次。1. STEP 7(Simatic Manager):STEP 7或者Simatic Manager是西门子PLC编程最常用的软件开发环境。4. STEP 7 MicroWin:STEP 7 MicroWn是一款专门针对微型PLC(S7-200系列PLC)的编程软件,是Simatic Manager的简化版。如果需要与PLC系统配合使用,则需要与PLC编程工具进行配合使用。除了上述软件之外,西门子还提供了一些配套软件和工具,如PLC模拟器、硬件调试工具等,以帮助PLC编程人员快速地进行调试和测试。_西门子plc编程软件

HashMap扩容_hashma扩容-程序员宅基地

文章浏览阅读36次。【代码】HashMap扩容。_hashma扩容

Eclipse maven项目中依赖包不全,如何重新加载?_maven资源加载不全,怎么重新加载-程序员宅基地

文章浏览阅读2.9k次。1mvn dependency:copy-dependencies2 项目右键 -> Maven -> Disable Maven Nature3 项目右键 -> Configure -> Convert to Maven Project_maven资源加载不全,怎么重新加载

mysql dml全称中文_MySQL语言分类——DML-程序员宅基地

文章浏览阅读527次。DMLDML的全称是Database management Language,数据库管理语言。主要包括以下操作:insert、delete、update、optimize。本篇对其逐一介绍INSERT数据库表插入数据的方式:1、insert的完整语法:(做项目的过程中将字段名全写上,这样比较容易看懂)单条记录插入语法:insert into table_name (column_name1,......_dml的全称是

【小工匠聊Modbus】04-调试工具-程序员宅基地

文章浏览阅读136次。可以参考: http://git.oschina.net/jrain-group/ 组织下的Java Modbus支持库Modbus-系列文章1、虚拟成对串口(1)下载虚拟串口软件VSPD(可在百度中搜索)image.png(2)打开软件,添加虚拟串口。在设备管理中,看到如下表示添加成功。..._最好用的 modebus调试工具

推荐文章

热门文章

相关标签