<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>https://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>https://jackxiang.com/post//</link>
<title><![CDATA[[实践OK]python获取传入argv参数列表，以及字符为空判断，python退出之退出os._exit(-1)。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Tue, 23 Feb 2021 09:43:57 +0000</pubDate> 
<guid>https://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	<textarea name="code" class="php" rows="15" cols="100">
#coding=utf-8
import sys
import os
import xlrd&nbsp;&nbsp;# 导入库

for i in range(len(sys.argv)):
&nbsp;&nbsp;&nbsp;&nbsp;print (&quot;sys.argv[%d] = %s&quot; % (i, sys.argv[i]))
</textarea><br/><br/>python excelsearchKeyList.py k.txt<br/>sys.argv[0] = excelsearchKeyList.py<br/>sys.argv[1] = k.txt<br/><br/>二）判断字符为空：<br/><textarea name="code" class="php" rows="15" cols="100">
#coding=utf-8
import sys
import os
import xlrd&nbsp;&nbsp;# 导入库
# 打开文件
if len(sys.argv) &gt;= 2: 
&nbsp;&nbsp;file = open(sys.argv[1])
&nbsp;&nbsp;# file = open(&quot;/Users/jackXiang/pylearning/k.txt&quot;)
else: 
&nbsp;&nbsp;file = open(&quot;/Users/jackXiang/pylearning/cctvhyjykeywordslist.txt&quot;)

for line in file:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line = line.replace(&#039;&#92;r&#039;,&#039;&#039;).replace(&#039;&#92;n&#039;,&#039;&#039;).replace(&#039;&#92;t&#039;,&#039;&#039;)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if line.strip()==&#039;&#039;:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print (&#039;line is null&#039;)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(line)

</textarea><br/><br/>python excelsearchKeyList.py&nbsp;&nbsp;k.txt<br/>原创视频<br/>line is null<br/>line is null<br/><br/><br/><br/>三）判断是否传入新的参数：<br/><textarea name="code" class="php" rows="15" cols="100">
# 打开文件
if len(sys.argv) &gt;= 2: 
&nbsp;&nbsp;print(sys.argv[1])
&nbsp;&nbsp;file = open(sys.argv[1])
else: 
&nbsp;&nbsp;file = open(&quot;/Users/jackXiang/pylearning/cctvhyjykeywordslist.txt&quot;)
for line in file:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(line)

os._exit(-1)
# os._exit(-1)
sys.exit()
</textarea><br/><br/>来自：https://blog.csdn.net/index20001/article/details/74294945#:~:text=Python%E7%A8%8B%E5%BA%8F%E6%9C%89%E4%B8%A4%E7%A7%8D,%E8%A7%A3%E9%87%8A%E5%99%A8%E5%B0%86%E4%BC%9A%E9%80%80%E5%87%BA%E3%80%82
]]>
</description>
</item><item>
<link>https://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [实践OK]python获取传入argv参数列表，以及字符为空判断，python退出之退出os._exit(-1)。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>