这是我今天遇到的另一个巨大陷阱.
我花了几个小时调试我的代码,最后我发现它是由这个奇怪的设置引起的
下面是我的python提示界面
'3' > '2'
True
'4' > '3'
True
'15' > '11'
True
'999233' > '123'
True
# At this point, you must think compare string numbers is just like compare numbers.
# Me too, but...
'5' > '15'
True
# What's this !!!???
# Meanwhile I am asking this question. I want to something exaggerated to mockerying
# this mechanism, and I find something surprised me:
'5' > '999233'
False
# What!!!???
# Suddenly an idea come …Run Code Online (Sandbox Code Playgroud) 谁能告诉我这个脚本会做什么?什么是第3行的-z?
Filename=File.txt
X=`ls /home/$Filename`
if [ -z "$X" ]; then
exit
fi
Run Code Online (Sandbox Code Playgroud) 我在一个目录中有大量文件及其他语言的翻译.有10种不同语言的文件和2或3中的文件xx_xxxx_EN.html.文件的典型名称是及其翻译xx_xxxx_IT.html.我想提取一个包含文件名称的2列txt文件.例如,英语 - 意大利语对:
xx_xxxx_EN.html xx_xxxx_IT.html
我需要这种格式的正则表达式,xxxx-xxx-xx.jpg其中x是数字[0-9].
匹配例如: 3402-560-27.jpg