File "getSystemInfo.py", line 43
return(str(os.popen("top -n1 | awk '/Cpu\\(s\\):/ {print
^
SyntaxError: EOL while scanning string literal
报错,我的提示是这个样子的~~~~ 呵呵,我把getCPUuse()函数及相关调用去掉后就好了,结果如下
CPU Temperature = 40.6
RAM Total = 253.0 MB
RAM Used = 56.0 MB
RAM Free = 196.0 MB
DISK Total Space = 7.2GB
DISK Used Space = 2.3GB
DISK Used Percentage = 33%
改后源代码见附件 最新更新:getCPUuse添加进来了
出问题的地方是下面这句话太长
return(str(os.popen("top -n1 | awk '/Cpu\(s\):/ {print $2}'").readline().strip(\25.)))
改成一下两段就好了
res = os.popen("top -n1 | awk '/Cpu\(s\):/ {print $2}'").readline()
return(str(res.strip(\)))
系统输出如下
CPU Temperature = 40.6
CPU Use = 2.4
RAM Total = 253.0 MB
RAM Used = 57.0 MB
RAM Free = 196.0 MB
DISK Total Space = 7.2GB
DISK Used Space = 2.3GB
DISK Used Percentage = 33%
pi@neorpi ~ $ python get.py
File "get.py", line 35
return(str(res.strip(\)))
^
SyntaxError: unexpected character after line continuation character
求助呀,执行起来有问题~~~ yangsheng_net 发表于 2014-2-14 22:07 static/image/common/back.gif
最新更新:getCPUuse添加进来了
出问题的地方是下面这句话太长
return(str(os.popen("top -n1 | awk '/Cp ...
复制了附件内容 现在正常显示了 python 暴强 good!!!
页:
1
[2]