一、条件判断if 语句比如,输入用户年龄,根据年龄打印不同的内容,在Python程序中,可以用if语句实现:注意: Python代码的缩进规则。具有相同缩进的代码被视为代码块,上面的3行 print 语句就构成一个代码块(但不包括第4行的print)。如果 if 语句判断为 True,就会执行这个代...
分类:
编程语言 时间:
2015-09-14 00:32:35
阅读次数:
296
StringLiterals(Java语言规范JavaLanguageSpecifications)Theprogramconsistingofthecompilationunit:packagetestPackage;classTest{publicstaticvoidmain(String[]args){Stringhello="Hello",lo="lo";System.out.print((hello=="Hello")+"");System.out.print((Other.hello=..
分类:
编程语言 时间:
2015-09-13 20:04:56
阅读次数:
148
这道题是这样的 1 #include 2 void print() 3 { 4 //只可以在这里写代码, 5 //输出arr数组中的所有内容 6 } 7 int main() 8 { 9 int a = 1;10 int b = 2;11 char c = ...
分类:
其他好文 时间:
2015-09-13 18:38:14
阅读次数:
108
1.安装python解释器和ide,这里选择pycharm,配好环境2.列表的例子: python没有数组,只有元组合列表 列表例子如下movies=["titanic","the big bang theory"]print (movies[0]) 列表支持insert,pop,remove...
分类:
编程语言 时间:
2015-09-13 13:18:56
阅读次数:
187
public interface Printer { public abstract void open(); public abstract void close(); public abstract void print();}public class HPPrinter imple...
分类:
其他好文 时间:
2015-09-13 13:14:38
阅读次数:
115
在正则表达式里,经常要使用斜线(\)来指明一个集合,但是斜线(\)也是字符串里转义字符的特定标志,为了编写正则表达式更简单,可以使用原始字符串的方式,也就是在字符串前面添加小写字母r来指明。下面这个例子使用到两个正则表达式语句是等价的。例子:print(r'text')print( re.match(r"\W(.)\1\W", " ff "))print( re.match("\\W(.)\\1\...
分类:
其他好文 时间:
2015-09-13 09:23:35
阅读次数:
158
词法分析器或者叫扫描器主要用来分析字符串的文本,然后把文本里组成的单词分析出来,识别为某一类型的属性。对于编写编译器或者解析器的第一步工作就是做这样的事情:词法分析。以前有很多种使用字符串搜索的办法,这里使用正则表达式来实现这个目的。例子:print("词法分析器")
import collections
import re
Token = collections.namedtuple('To...
分类:
其他好文 时间:
2015-09-13 09:22:43
阅读次数:
140
Most commands operate like this: command -options argumentspwd(print working directory)cd(change directory). Absolute pathname: "cd /home/students...
分类:
系统相关 时间:
2015-09-13 09:19:09
阅读次数:
224
1. php指针没有重置$arr = array( array('aaaaaaaa'), array('bbbbbbb'));unset($arr[0]);unset($arr[1]);sort($arr);$arr[] = array('cccccccccc');print_r(arr...
分类:
Web程序 时间:
2015-09-13 07:04:57
阅读次数:
143
可以这样调用 {$sorts[$id][‘name‘]}?
或在模板中直接这样调用
<?php?print_r($sorts["$id"][‘name‘])?> 如果要在内容页调用所属栏目名.可以这样,即先统计数组数量,再取最后一个数组对应的值 <?php?print_r($...
分类:
其他好文 时间:
2015-09-12 17:48:24
阅读次数:
126