php中的sprinf可以格式化字符串的数据类型.今天遇到了想在其中输出%,可难倒我了. $query = sprintf("select * from books where %s like '% %s %'",$searchtype,$searchterm); //我以为输出是这样的:select * from books where title like '% java %' ,但实际上输出会是select * from books where title like '% 将其
1.数组 public class Test{ public static void main(String args[]){ int[] intArray = new int[] {1,4,3,2,5};//等价于 : int intArray[] = new int[] {1,2,3,4,5}; System.out.println(intArray.length); //打印长度 //使用java.util.Arrays工具类 来操作 数组 System.out.println(java.
字符串格式化 %s 可以接收任何值, %d只能接收整形 .其他类型报错 msg ='i am %s my body' %'ales' print(msg) #i am ales my body msg ='i am %s my body is %s' %('alex','xiaoming') #穿多个值加括号 print(msg) #i am alex my body is xiaoming 打印浮点数 tpl = "percent %f" %99.978979934 print(tp
可变数据类型与不可变数据类型: 1.可变:列表,字典 2.不可变:字符串,数字,元组 访问顺序: 1.顺序访问:字符串,列表,元组 2.映射:字典 集合 由不同元素组成的集合,集合中是一组无序排列的可hash的值,可以作为字典的key 1.不同元素组成 2.无序 3.集合中元素必须是不可变类型,如:字符串,数字,元组 集合的定义:s={1,2,5,6,7} s = {0,1,2,4,5,6,7,7,7,8,9}for i in s : print(i) v={(1,2,3,),5} for i