小编Chr*_*our的帖子

排序整数的字符串表示

这是我今天遇到的另一个巨大陷阱.

我花了几个小时调试我的代码,最后我发现它是由这个奇怪的设置引起的

下面是我的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)

python

-4
推荐指数
1
解决办法
180
查看次数

解释这个bash脚本

谁能告诉我这个脚本会做什么?什么是第3行的-z?

  Filename=File.txt
  X=`ls /home/$Filename`
  if [ -z "$X" ]; then
  exit
  fi
Run Code Online (Sandbox Code Playgroud)

unix bash shell

-5
推荐指数
1
解决办法
136
查看次数

在linux中配对文件

我在一个目录中有大量文件及其他语言的翻译.有10种不同语言的文件和2或3中的文件xx_xxxx_EN.html.文件的典型名称是及其翻译xx_xxxx_IT.html.我想提取一个包含文件名称的2列txt文件.例如,英语 - 意大利语对: xx_xxxx_EN.html xx_xxxx_IT.html

python unix linux bash perl

-5
推荐指数
1
解决办法
112
查看次数

需要正则表达式的数字和破折号

我需要这种格式的正则表达式,xxxx-xxx-xx.jpg其中x是数字[0-9].

匹配例如: 3402-560-27.jpg

c# regex

-7
推荐指数
1
解决办法
136
查看次数

标签 统计

bash ×2

python ×2

unix ×2

c# ×1

linux ×1

perl ×1

regex ×1

shell ×1