psutil documentation

psutil documentation转载自https://pythonhosted.org/psutil/#psutil.STATUS_RUNNINGWarning Thisdocumentationreferstonew2.Xversionofpsutil.Instructionsonhowtoportexisting1.2.1codeare here.Old1

大家好,又见面了,我是你们的朋友全栈君。

转载自https://pythonhosted.org/psutil/#psutil.STATUS_RUNNING

Warning

 

This documentation refers to new 2.X version of psutil. Instructions on how to port existing 1.2.1 code are here. Old 1.2.1 documentation is still available here.

psutil documentation

About

From project’s home page:

psutil (python system and process utilities) is a cross-platform library for retrieving information on running 
processes and
system utilization (CPU, memory, disks, network) in 
Python. It is useful mainly for 
system monitoring
profiling and
limiting process resources and 
management of running processes. It implements many functionalities offered by command line tools such as: 
ps, top, lsof, netstat, ifconfig, who, df, kill, free, nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It currently supports 
Linux, Windows, OSX, FreeBSD and 
Sun Solaris, both 
32-bit and 
64-bitarchitectures, with Python versions from 
2.6 to 3.4 (users of Python 2.4 and 2.5 may use 
2.1.3 version). 
PyPy is also known to work.

The psutil documentation you’re reading is distributed as a single HTML page.

Processes

Functions

psutil.
pids
(
)
[source]

Return a list of current running PIDs. To iterate over all processes process_iter() should be preferred.

psutil.
pid_exists
(
pid
)
[source]

Check whether the given PID exists in the current process list. This is faster than doing "pid in psutil.pids()" and should be preferred.

psutil.
process_iter
(
)
[source]

Return an iterator yielding a Process class instance for all running processes on the local machine. Every instance is only created once and then cached into an internal table which is updated every time an element is yielded. Cached Process instances are checked for identity so that you’re safe in case a PID has been reused by another process, in which case the cached instance is updated. This is should be preferred over psutil.pids() for iterating over processes. Sorting order in which processes are returned is based on their PID. Example usage:

import psutil

for proc in psutil.process_iter():
    try:
        pinfo = proc.as_dict(attrs=['pid', 'name'])
    except psutil.NoSuchProcess:
        pass
    else:
        print(pinfo)

psutil.
wait_procs
(
procs
timeout=None
callback=None
)
[source]

Convenience function which waits for a list of Process instances to terminate. Return a (gone, alive) tuple indicating which processes are gone and which ones are still alive. The gone ones will have a new returncode attribute indicating process exit status (it may be None). callback is a function which gets called every time a process terminates (a Process instance is passed as callback argument). Function will return as soon as all processes terminate or when timeout occurs. Tipical use case is:

  • send SIGTERM to a list of processes
  • give them some time to terminate
  • send SIGKILL to those ones which are still alive

Example:

import psutil

def on_terminate(proc):
    print("process {} terminated".format(proc))

procs = [...]  # a list of Process instances
for p in procs:
    p.terminate()
gone, alive = wait_procs(procs, timeout=3, callback=on_terminate)
for p in alive:
    p.kill()

Exceptions

class 
psutil.
Error
[source]

Base exception class. All other exceptions inherit from this one.

class 
psutil.
NoSuchProcess
(
pid
name=None
msg=None
)
[source]

Raised by Process class methods when no process with the given pid is found in the current process list or when a process no longer exists. “name” is the name the process had before disappearing and gets set only if Process.name() was previosly called.

class 
psutil.
AccessDenied
(
pid=None
name=None
msg=None
)
[source]

Raised by Process class methods when permission to perform an action is denied. “name” is the name of the process (may beNone).

class 
psutil.
TimeoutExpired
(
seconds
pid=None
name=None
msg=None
)
[source]

Raised by Process.wait() if timeout expires and process is still alive.

Process class

class 
psutil.
Process
(
pid=None
)
[source]

Represents an OS process with the given pid. If pid is omitted current process pid (os.getpid()) is used. Raise NoSuchProcess if piddoes not exist. When accessing methods of this class always be prepared to catch NoSuchProcess and AccessDenied exceptions.hash() builtin can be used against instances of this class in order to identify a process univocally over time (the hash is determined by mixing process PID and creation time). As such it can also be used with set()s.

Warning

 

the way this class is bound to a process is uniquely via its PID. That means that if the Process instance is old enough and the PID has been reused by another process in the meantime you might end up interacting with another process. The only exceptions for which process identity is pre-emptively checked (via PID + creation time) and guaranteed are for nice()(set), ionice() (set), cpu_affinity() (set), rlimit() (set), children()parent()suspend() resume()send_signal()terminate(), and kill()methods. To prevent this problem for all other methods you can use is_running() before querying the process or use process_iter()in case you’re iterating over all processes.

pid
[source]

The process PID.

ppid
(
)
[source]

The process parent pid. On Windows the return value is cached after first call.

name
(
)
[source]

The process name. The return value is cached after first call.

exe
(
)
[source]

The process executable as an absolute path. On some systems this may also be an empty string. The return value is cached after first call.

cmdline
(
)
[source]

The command line this process has been called with.

create_time
(
)
[source]

The process creation time as a floating point number expressed in seconds since the epoch, in UTC. The return value is cached after first call.

>>>

>>> import psutil, datetime
>>> p = psutil.Process()
>>> p.create_time()
1307289803.47
>>> datetime.datetime.fromtimestamp(p.create_time()).strftime("%Y-%m-%d %H:%M:%S")
'2011-03-05 18:03:52'

as_dict
(
attrs=None
ad_value=None
)
[source]

Utility method returning process information as a hashable dictionary. If attrs is specified it must be a list of strings reflecting available Process class’s attribute names (e.g. ['cpu_times', 'name']) else all public (read only) attributes are assumed. ad_valueis the value which gets assigned to a dict key in case AccessDenied exception is raised when retrieving that particular process information.

>>>

>>> import psutil
>>> p = psutil.Process()
>>> p.as_dict(attrs=['pid', 'name', 'username'])
{'username': 'giampaolo', 'pid': 12366, 'name': 'python'}

parent
(
)
[source]

Utility method which returns the parent process as a Process object pre-emptively checking whether PID has been reused. If no parent PID is known return None.

status
(
)
[source]

The current process status as a string. The returned string is one of the psutil.STATUS_* constants.

cwd
(
)
[source]

The process current working directory as an absolute path.

username
(
)
[source]

The name of the user that owns the process. On UNIX this is calculated by using real process uid.

uids
(
)
[source]

The realeffective and saved user ids of this process as a nameduple. This is the same as os.getresuid() but can be used for every process PID.

Availability: UNIX

gids
(
)
[source]

The realeffective and saved group ids of this process as a nameduple. This is the same as os.getresgid() but can be used for every process PID.

Availability: UNIX

terminal
(
)
[source]

The terminal associated with this process, if any, else None. This is similar to “tty” command but can be used for every process PID.

Availability: UNIX

nice
(
value=None
)
[source]

Get or set process niceness (priority). On UNIX this is a number which usually goes from -20 to 20. The higher the nice value, the lower the priority of the process.

>>>

>>> import psutil
>>> p = psutil.Process()
>>> p.nice(10)  # set
>>> p.nice()  # get
10
>>>

On Windows this is available as well by using GetPriorityClass and SetPriorityClass and value is one of thepsutil.*_PRIORITY_CLASS constants. Example which increases process priority on Windows:

>>>

>>> p.nice(psutil.HIGH_PRIORITY_CLASS)

Starting from Python 3.3 this same functionality is available as os.getpriority() and os.setpriority().

ionice
(
ioclass=None
value=None
)
[source]

Get or set process I/O niceness (priority). On Linux ioclass is one of the psutil.IOPRIO_CLASS_* constants. value is a number which goes from 0 to 7. The higher the value, the lower the I/O priority of the process. On Windows only ioclass is used and it can be set to 2 (normal), 1 (low) or 0 (very low). The example below sets IDLE priority class for the current process, meaning it will only get I/O time when no other process needs the disk:

>>>

>>> import psutil
>>> p = psutil.Process()
>>> p.ionice(psutil.IOPRIO_CLASS_IDLE)  # set
>>> p.ionice()  # get
pionice(ioclass=3, value=0)
>>>

On Windows only ioclass is used and it can be set to 2 (normal), 1 (low) or 0 (very low).

Availability: Linux and Windows > Vista

rlimit
(
resource
limits=None
)
[source]

Get or set process resource limits (see man prlimit). resource is one of the psutil.RLIMIT_* constants. limits is a (soft, hard)tuple. This is the same as resource.getrlimit() and resource.setrlimit() but can be used for every process PID and only on Linux. Example:

>>>

>>> import psutil
>>> p = psutil.Process()
>>> # process may open no more than 128 file descriptors
>>> p.rlimit(psutil.RLIMIT_NOFILE, (128, 128))
>>> # process may create files no bigger than 1024 bytes
>>> p.rlimit(psutil.RLIMIT_FSIZE, (1024, 1024))
>>> # get
>>> p.rlimit(psutil.RLIMIT_FSIZE)
(1024, 1024)
>>>

Availability: Linux

io_counters
(
)
[source]

Return process I/O statistics as a namedtuple including the number of read and write operations performed by the process and the amount of bytes read and written. For Linux refer to /proc filesysem documentation. On BSD there’s apparently no way to retrieve bytes counters, hence -1 is returned for read_bytes and write_bytes fields. OSX is not supported.

>>>

>>> import psutil
>>> p = psutil.Process()
>>> p.io_counters()
pio(read_count=454556, write_count=3456, read_bytes=110592, write_bytes=0)

Availability: all platforms except OSX

num_ctx_switches
(
)
[source]

The number voluntary and involuntary context switches performed by this process.

num_fds
(
)
[source]

The number of file descriptors used by this process.

Availability: UNIX

num_handles
(
)
[source]

The number of handles used by this process.

Availability: Windows

num_threads
(
)
[source]

The number of threads currently used by this process.

threads
(
)
[source]

Return threads opened by process as a list of namedtuples including thread id and thread CPU times (user/system).

cpu_times
(
)
[source]

Return a tuple whose values are process CPU user and system times which means the amount of time expressed in seconds that a process has spent in user / system mode. This is similar to os.times() but can be used for every process PID.

cpu_percent
(
interval=None
)
[source]

Return a float representing the process CPU utilization as a percentage. When interval is > 0.0 compares process times to system CPU times elapsed before and after the interval (blocking). When interval is 0.0 or None compares process times to system CPU times elapsed since last call, returning immediately. That means the first time this is called it will return a meaningless 0.0 value which you are supposed to ignore. In this case is recommended for accuracy that this function be called a second time with at least 0.1 seconds between calls. Example:

>>>

>>> import psutil
>>> p = psutil.Process()
>>>
>>> # blocking
>>> p.cpu_percent(interval=1)
2.0
>>> # non-blocking (percentage since last call)
>>> p.cpu_percent(interval=None)
2.9
>>>

Note

 

a percentage > 100 is legitimate as it can result from a process with multiple threads running on different CPU cores.

Warning

 

the first time this method is called with interval = 0.0 or None it will return a meaningless 0.0 value which you are supposed to ignore.

cpu_affinity
(
cpus=None
)
[source]

Get or set process current CPU affinity. CPU affinity consists in telling the OS to run a certain process on a limited set of CPUs only. The number of eligible CPUs can be obtained with list(range(psutil.cpu_count())).

>>>

>>> import psutil
>>> psutil.cpu_count()
4
>>> p = psutil.Process()
>>> p.cpu_affinity()  # get
[0, 1, 2, 3]
>>> p.cpu_affinity([0])  # set; from now on, process will run on CPU #0 only
>>> p.cpu_affinity()
[0]
>>>
>>> # reset affinity against all CPUs
>>> all_cpus = list(range(psutil.cpu_count()))
>>> p.cpu_affinity(all_cpus)
>>>

Availability: Linux, Windows, BSD

Changed in version 2.2.0: added support for FreeBSD

memory_info
(
)
[source]

Return a tuple representing RSS (Resident Set Size) and VMS (Virtual Memory Size) in bytes. On UNIX rss and vms are the same values shown by ps. On Windows rss and vms refer to “Mem Usage” and “VM Size” columns of taskmgr.exe. For more detailed memory stats use memory_info_ex().

memory_info_ex
(
)
[source]

Return a namedtuple with variable fields depending on the platform representing extended memory information about the process. All numbers are expressed in bytes.

Linux OSX BSD SunOS Windows
rss rss rss rss num_page_faults
vms vms vms vms peak_wset
shared pfaults text   wset
text pageins data   peak_paged_pool
lib   stack   paged_pool
data       peak_nonpaged_pool
dirty       nonpaged_pool
        pagefile
        peak_pagefile
        private

Windows metrics are extracted from PROCESS_MEMORY_COUNTERS_EX structure. Example on Linux:

>>>

>>> import psutil
>>> p = psutil.Process()
>>> p.memory_info_ex()
pextmem(rss=15491072, vms=84025344, shared=5206016, text=2555904, lib=0, data=9891840, dirty=0)

memory_percent
(
)
[source]

Compare physical system memory to process resident memory (RSS) and calculate process memory utilization as a percentage.

memory_maps
(
grouped=True
)
[source]

Return process’s mapped memory regions as a list of nameduples whose fields are variable depending on the platform. As such, portable applications should rely on namedtuple’s path and rss fields only. This method is useful to obtain a detailed representation of process memory usage as explained here. If grouped is True the mapped regions with the same path are grouped together and the different memory fields are summed. If grouped is False every mapped region is shown as a single entity and the namedtuple will also include the mapped region’s address space (addr) and permission set (perms). Seeexamples/pmap.py for an example application.

>>>

>>> import psutil
>>> p = psutil.Process()
>>> p.memory_maps()
[pmmap_grouped(path='/lib/x8664-linux-gnu/libutil-2.15.so', rss=16384, anonymous=8192, swap=0),
 pmmap_grouped(path='/lib/x8664-linux-gnu/libc-2.15.so', rss=6384, anonymous=15, swap=0),
 pmmap_grouped(path='/lib/x8664-linux-gnu/libcrypto.so.0.1', rss=34124, anonymous=1245, swap=0),
 pmmap_grouped(path='[heap]', rss=54653, anonymous=8192, swap=0),
 pmmap_grouped(path='[stack]', rss=1542, anonymous=166, swap=0),
 ...]
>>>

children
(
recursive=False
)
[source]

Return the children of this process as a list of Process objects, pre-emptively checking whether PID has been reused. If recursive is True return all the parent descendants. Example assuming A == this process:

A ─┐
   │
   ├─ B (child) ─┐
   │             └─ X (grandchild) ─┐
   │                                └─ Y (great grandchild)
   ├─ C (child)
   └─ D (child)

>>> p.children()
B, C, D
>>> p.children(recursive=True)
B, X, Y, C, D

Note that in the example above if process X disappears process Y won’t be returned either as the reference to process A is lost.

open_files
(
)
[source]

Return regular files opened by process as a list of namedtuples including the absolute file name and the file descriptor number (on Windows this is always -1). Example:

>>>

>>> import psutil
>>> f = open('file.ext', 'w')
>>> p = psutil.Process()
>>> p.open_files()
[popenfile(path='/home/giampaolo/svn/psutil/file.ext', fd=3)]

connections
(
kind=”inet”
)
[source]

Return socket connections opened by process as a list of namedutples. To get system-wide connections usepsutil.net_connections(). Every namedtuple provides 6 attributes:

  • fd: the socket file descriptor. This can be passed to socket.fromfd() to obtain a usable socket object. This is only available on UNIX; on Windows -1 is always returned.
  • family: the address family, either AF_INETAF_INET6 or AF_UNIX.
  • type: the address type, either SOCK_STREAM or SOCK_DGRAM.
  • laddr: the local address as a (ip, port) tuple or a path in case of AF_UNIX sockets.
  • raddr: the remote address as a (ip, port) tuple or an absolute path in case of UNIX sockets. When the remote endpoint is not connected you’ll get an empty tuple (AF_INET) or None (AF_UNIX). On Linux AF_UNIX sockets will always have this set to None.
  • status: represents the status of a TCP connection. The return value is one of the psutil.CONN_* constants. For UDP and UNIX sockets this is always going to be psutil.CONN_NONE.

The kind parameter is a string which filters for connections that fit the following criteria:

Kind value Connections using
“inet” IPv4 and IPv6
“inet4” IPv4
“inet6” IPv6
“tcp” TCP
“tcp4” TCP over IPv4
“tcp6” TCP over IPv6
“udp” UDP
“udp4” UDP over IPv4
“udp6” UDP over IPv6
“unix” UNIX socket (both UDP and TCP protocols)
“all” the sum of all the possible families and protocols

Example:

>>>

>>> import psutil
>>> p = psutil.Process(1694)
>>> p.name()
'firefox'
>>> p.connections()
[pconn(fd=115, family=2, type=1, laddr=('10.0.0.1', 48776), raddr=('93.186.135.91', 80), status='ESTABLISHED'),
 pconn(fd=117, family=2, type=1, laddr=('10.0.0.1', 43761), raddr=('72.14.234.100', 80), status='CLOSING'),
 pconn(fd=119, family=2, type=1, laddr=('10.0.0.1', 60759), raddr=('72.14.234.104', 80), status='ESTABLISHED'),
 pconn(fd=123, family=2, type=1, laddr=('10.0.0.1', 51314), raddr=('72.14.234.83', 443), status='SYN_SENT')]

is_running
(
)
[source]

Return whether the current process is running in the current process list. This is reliable also in case the process is gone and its PID reused by another process, therefore it must be preferred over doing psutil.pid_exists(p.pid).

Note

 

this will return True also if the process is a zombie (p.status() == psutil.STATUS_ZOMBIE).

send_signal
(
signal
)
[source]

Send a signal to process (see signal module constants) pre-emptively checking whether PID has been reused. This is the same as os.kill(pid, sig). On Windows only SIGTERM is valid and is treated as an alias for kill().

suspend
(
)
[source]

Suspend process execution with SIGSTOP signal pre-emptively checking whether PID has been reused. On UNIX this is the same as os.kill(pid, signal.SIGSTOP). On Windows this is done by suspending all process threads execution.

resume
(
)
[source]

Resume process execution with SIGCONT signal pre-emptively checking whether PID has been reused. On UNIX this is the same as os.kill(pid, signal.SIGCONT). On Windows this is done by resuming all process threads execution.

terminate
(
)
[source]

Terminate the process with SIGTERM signal pre-emptively checking whether PID has been reused. On UNIX this is the same as os.kill(pid, signal.SIGTERM). On Windows this is an alias for kill().

kill
(
)
[source]

Kill the current process by using SIGKILL signal pre-emptively checking whether PID has been reused. On UNIX this is the same as os.kill(pid, signal.SIGKILL). On Windows this is done by using TerminateProcess.

wait
(
timeout=None
)
[source]

Wait for process termination and if the process is a children of the current one also return the exit code, else None. On Windows there’s no such limitation (exit code is always returned). If the process is already terminated immediately returnNone instead of raising NoSuchProcess. If timeout is specified and process is still alive raise TimeoutExpired exception. It can also be used in a non-blocking fashion by specifying timeout=0 in which case it will either return immediately or raiseTimeoutExpired. To wait for multiple processes use psutil.wait_procs().

Popen class

class 
psutil.
Popen
(
*args
**kwargs
)
[source]

A more convenient interface to stdlib subprocess.Popen. It starts a sub process and deals with it exactly as when usingsubprocess.Popen but in addition it also provides all the methods of psutil.Process class in a single interface. For method names common to both classes such as send_signal()terminate() and kill() psutil.Process implementation takes precedence. For a complete documentation refer to subprocess module documentation.

Note

 

Unlike subprocess.Popen this class pre-emptively checks wheter PID has been reused on send_signal()terminate() andkill() so that you don’t accidentally terminate another process, fixing http://bugs.python.org/issue6973.

>>>

>>> import psutil
>>> from subprocess import PIPE
>>>
>>> p = psutil.Popen(["/usr/bin/python", "-c", "print('hello')"], stdout=PIPE)
>>> p.name()
'python'
>>> p.username()
'giampaolo'
>>> p.communicate()
('hello\n', None)
>>> p.wait(timeout=2)
0
>>>

Constants

psutil.
STATUS_RUNNING

psutil.
STATUS_SLEEPING

psutil.
STATUS_DISK_SLEEP

psutil.
STATUS_STOPPED

psutil.
STATUS_TRACING_STOP

psutil.
STATUS_ZOMBIE

psutil.
STATUS_DEAD

psutil.
STATUS_WAKE_KILL

psutil.
STATUS_WAKING

psutil.
STATUS_IDLE

psutil.
STATUS_LOCKED

psutil.
STATUS_WAITING

A set of strings representing the status of a process. Returned by psutil.Process.status().

psutil.
CONN_ESTABLISHED

psutil.
CONN_SYN_SENT

psutil.
CONN_SYN_RECV

psutil.
CONN_FIN_WAIT1

psutil.
CONN_FIN_WAIT2

psutil.
CONN_TIME_WAIT

psutil.
CONN_CLOSE

psutil.
CONN_CLOSE_WAIT

psutil.
CONN_LAST_ACK

psutil.
CONN_LISTEN

psutil.
CONN_CLOSING

psutil.
CONN_NONE

psutil.
CONN_DELETE_TCB
(
Windows
)

psutil.
CONN_IDLE
(
Solaris
)

psutil.
CONN_BOUND
(
Solaris
)

A set of strings representing the status of a TCP connection. Returned by psutil.Process.connections() (status field).

psutil.
ABOVE_NORMAL_PRIORITY_CLASS

psutil.
BELOW_NORMAL_PRIORITY_CLASS

psutil.
HIGH_PRIORITY_CLASS

psutil.
IDLE_PRIORITY_CLASS

psutil.
NORMAL_PRIORITY_CLASS

psutil.
REALTIME_PRIORITY_CLASS

A set of integers representing the priority of a process on Windows (see MSDN documentation). They can be used in conjunction with psutil.Process.nice() to get or set process priority.

Availability: Windows

psutil.
IOPRIO_CLASS_NONE

psutil.
IOPRIO_CLASS_RT

psutil.
IOPRIO_CLASS_BE

psutil.
IOPRIO_CLASS_IDLE

A set of integers representing the I/O priority of a process on Linux. They can be used in conjunction with psutil.Process.ionice() to get or set process I/O priority. IOPRIO_CLASS_NONE and IOPRIO_CLASS_BE (best effort) is the default for any process that hasn’t set a specific I/O priority. IOPRIO_CLASS_RT (real time) means the process is given first access to the disk, regardless of what else is going on in the system. IOPRIO_CLASS_IDLE means the process will get I/O time when no-one else needs the disk. For further information refer to manuals of ionice command line utility or ioprio_get system call.

Availability: Linux

psutil.
RLIMIT_INFINITY

psutil.
RLIMIT_AS

psutil.
RLIMIT_CORE

psutil.
RLIMIT_CPU

psutil.
RLIMIT_DATA

psutil.
RLIMIT_FSIZE

psutil.
RLIMIT_LOCKS

psutil.
RLIMIT_MEMLOCK

psutil.
RLIMIT_MSGQUEUE

psutil.
RLIMIT_NICE

psutil.
RLIMIT_NOFILE

psutil.
RLIMIT_NPROC

psutil.
RLIMIT_RSS

psutil.
RLIMIT_RTPRIO

psutil.
RLIMIT_RTTIME

psutil.
RLIMIT_RTPRIO
psutil.
RLIMIT_SIGPENDING

psutil.
RLIMIT_STACK

Constants used for getting and setting process resource limits to be used in conjunction with psutil.Process.rlimit(). See man prlimitfor futher information.

Availability: Linux

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/130886.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 104型计算机键盘,电脑上的pc 机104键指的是什么?「建议收藏」

    104型计算机键盘,电脑上的pc 机104键指的是什么?「建议收藏」匿名用户1级2019-11-30回答计算机键盘中的全部键按基本功能可分成四组,即键盘的四个分区:主键盘区、功能键区、编辑键区和数字键盘区1.主键盘区主键盘也称标准打字键盘,此键区除包含26个英文字母、10个数字符号、各种标点符号、数学符号、特殊符号等47个字符键外,还有若干基本的功能控制键。(1)字母键:所有字母键在键面上均刻印有大写的英文字母,表示上档符号为大写,下档符号为小写(即通常情况下…

    2022年10月28日
    0
  • String类型转换BigDecimal、Date类型

    String类型转换BigDecimal、Date类型String类型转换BigDecimal类型public static void main(String[] args) {         String str1="2.30";            BigDecimal bd=new BigDecimal(str1);            System.out.println(bd);    }Java String类型转换成D…

    2022年6月13日
    35
  • 此视频无法播放0xc00d36c4_视频播放失败代码-30

    此视频无法播放0xc00d36c4_视频播放失败代码-30相信很多用户都遇到过视频无法播放的问题。比如将重要视频从旧电脑拷到U盘上,使用另一台电脑播放时,提示视频播放错误代码0xc00d36c4,不支持该视频播放。其实,视频无法播放的问题是很常见的,不少用户在电脑上连接相机或者手机后播放视频,也会提示0xc00d36c4。出现这样的问题要怎么解决,怎么才能修复该视频文件使其正常播放?播放MP4格式视频显示错误代码0xc00d36c4的情况大多数情况下,…

    2022年9月29日
    0
  • 数据库常见面试题(附答案)

    数据库常见面试题(附答案)1.事务四大特性原子性,要么执行,要么不执行隔离性,所有操作全部执行完以前,其它会话不能看到过程一致性,事务前后,数据总额一致持久性,一旦事务提交,对数据的改变就是永久的2.数据库隔离级别,每个级别会引发什么问题,mysql默认是哪个级别脏读:事务B读取事务A还没有提交的数据不可重复读:两次事务读的数据不一致幻读:事务A修改了数据,事务B也修改了数据,这时在事务A看

    2022年5月2日
    73
  • vim查看特殊字符_js字符串替换特殊字符

    vim查看特殊字符_js字符串替换特殊字符转载来自:http://bbs.chinaunix.net/thread-4167320-1-1.html1.搜索特殊字符要加转义字符"\"eg:搜索17/Jan/201910:20:53vim文件,然后/,然后输入如下:17\/Jan\/2019\10:20:53或者17\/Jan\/2019\s10:20:53 …

    2022年9月2日
    3
  • solidworks第三方插件_django queryset合并

    solidworks第三方插件_django queryset合并前言mixins翻译成中文是混入,组件的意思。在DRF中,针对获取列表,检索,创建等操作,都有相应的mixin,一般我们自定义创建的类视图都会继承自GenericAPIView和Mixins一起使用

    2022年7月29日
    2

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号