python重复字符串n次 |
您所在的位置:网站首页 › python重复数字n次 › python重复字符串n次 |
$perl -e 'print "4"x4; print "\n"' 4444 在perldoc perlop中记录了x运算符.这里二进制意味着一个运算符采用两个参数,而不是由位组成. Binary “x” is the repetition operator. In scalar context or if the left operand is not enclosed in parentheses,it returns a string consisting of the left operand repeated the number of times specified by the right operand. In list context,if the left operand is enclosed in parentheses or is a list formed by “qw/STRING/“,it repeats the list. If the right operand is zero or negative,it returns an empty string or an empty list,depending on the context. print ’-’ x 80; # print row of dashes print "\t" x ($tab/8),’ ’ x ($tab%8); # tab over @ones = (1) x 80; # a list of 80 1’s @ones = (5) x @ones; # set all elements to 5 perl -e用于从命令行执行perl代码: $perl --help Usage: perl [switches] [--] [programfile] [arguments] -e program one line of program (several -e's allowed,omit programfile) |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |