python打乱数组顺序
2017年6月22日 23:44
import random a = [1, 2, 3, 4, 5]; random.shuffle(a) print a #[2, 3, 1, 5, 4]
此生必看的科学实验-水知道答案
为什么观看这部记录片
精神病为什么治不好
百病之源
净土大经科注2014
import random a = [1, 2, 3, 4, 5]; random.shuffle(a) print a #[2, 3, 1, 5, 4]
#取文件后缀 >>> os.path.splitext("/root/a.py") ('/root/a', '.py') #取目录与文件名 >>> os.path.split("/root/a.py") ('/root', 'a.py')
demo.nsi
Outfile "helloworld.exe" Section ;$0表示文件句柄, $1获得的文件名 FindFirst $0 $1 "$EXEDIR\*.py" loop: ;文件名为空结束循环 StrCmp $1 "" done ;打印 DetailPrint $1 ;通过句柄$0,查找下一个文件,得到文件名$1 FindNext $0 $1 Goto loop done: SectionEnd
PS C:\Users\wyq> Get-WmiObject Win32_OperatingSystem SystemDirectory : C:\WINDOWS\system32 Organization : BuildNumber : 14393 RegisteredUser : wyq SerialNumber : 00330-80000-00000-AA130 Version : 10.0.14393
Windows NT 3.1 Windows NT 3.1 Windows NT 3.5 Windows NT 3.5 Windows NT 3.51 Windows NT 3.51 Windows NT 4.0 Windows NT 4.0 Windows NT 5.0 Windows 2000 Windows NT 5.1 Windows xp Windows NT 5.2 Windows xp、Windows Server 2003、Wwindows Server 2003 R2 Windows NT 6.0 Windows Vista、Windows Server 2008 Windows NT 6.1 Windows 7、Windows Server 2008 R2 Windows NT 6.2 Windows 8、Windows Phone 8、Windows Server 2012 Windows NT 6.3 Windows Phone 8.1、Windows Server 2012 R2 Windows NT 6.4 Windows 10(技术预览版) Windows NT 10.0 Windows 10
select-string -Pattern "Keyword" -Path *.log select-string "Error" *.log
select-string "Error" *.log -casesensitive
select-string keyword1,keyword2 *.log
Get-ChildItem -include *.log -recurse |select-string keyword
import wmi _root_conn = wmi.WMI(privileges=["Shutdown"]) query_str = "select * from Win32_Volume where DeviceID like '%%%s%%'" % volume_id volume = _root_conn.query(query_str)[0] volume.DriveLetter = "M:" volume.put()
$Drive = Get-WmiObject win32_volume -Filter "Label = 'xxxx'" $Drive.DriveLetter = "m:" $Drive.put()
>>> import locale >>> locale.getdefaultlocale() ('zh_CN', 'cp936')
import locale cmd = cmd.encode(locale.getdefaultlocale()[1]) subprocess.Popen(cmd)
PS C:\Users\Administrator> Get-Volume DriveLetter FileSystemLabel FileSystem DriveType HealthStatus OperationalStatus SizeRemaining Size ----------- --------------- ---------- --------- ------------ ----------------- ------------- ---- G NTFS Fixed Healthy OK 320.86 GB 372.61 GB 系统保留 NTFS Fixed Healthy OK 301.87 MB 350 MB C NTFS Fixed Healthy OK 881.36 GB 931.17 GB NTFS Fixed Healthy OK 931.31 GB 931.51 GB
exe路径
>>> sys.executable 'C:\\Python27\\python.exe'
lib路径
>>> sys.prefix 'C:\\python27'