1,使用while循环输出1,2,3,4,5,6,8,9 # 使用while循环输出1,2,3,4,5,6,8,9 num = 1 while num <= 10: if num != 7: print (num ) num += 1 num = 1 while num < 10: num +=1 if num ==7: continue print(num) num = 1 while num < 10: num +=1 if num ==7: pass else: print(num…
一.ASCII码 ASCII(American Standard Code for Information Interchange,美国标准信息交换代码),8位,一个字节,最多只能表示255个符号. 二.GB2312(1980年) 一共收录了7445个字符,包括6763个汉字和682个其他符号,72*94=6768,含5个空位. 三.GBK 1.0(1995年) 21886个符号(其中有21003个汉字). 四.GB18030(2000年) 27484个汉字.同时还收录了藏文.蒙文.维吾尔文等主…
在使用Python做爬虫的过程中,经常遇到字符编码出问题的情况. UnicodeEncodeError: 'ascii' codec can't encode character u'\u6211' in position 0: ordinal not in range(128) 针对这种情况,网上已经有很多原理性的分析了,我在此就不一一列举.然而,我相信很多人,即便看完原理以后也不知道怎么解决. 我自己琢磨出一种快速解决的方法: def get_page_sourse(url): req =…
1.修改数据库字符编码 mysql> alter database mydb character set utf8 ; 2.创建数据库时,指定数据库的字符编码 mysql> create database mydb character set utf8 ; 3.查看mysql数据库的字符编码 mysql> show variables like 'character%'; //查询当前mysql数据库的所有属性的字符编码 +--------------------------+-----…
一.前言 继上一篇写完字节编码内容后,现在分析在Java中各字符编码的问题,并且由这个问题,也引出了一个更有意思的问题,笔者也还没有找到这个问题的答案.也希望各位园友指点指点. 二.Java字符编码 直接上代码进行分析似乎更有感觉. public class Test { public static String stringInfo(String str, String code) throws Exception { byte[] bytes = null; if (code.equals(…
Mysql数据库是一个开源的数据库,应用非常广泛.以下是修改mysql数据库的字符编码的操作过程和将表的字符编码转换成utf-8的方法,需要的朋友可以参考下. mysql将表的字符编码转换成utf-8: alter table tb_anniversary convert to character set utf8; 修改数据库mysql字符编码为UTF8: 步骤1:查看当前的字符编码方法: mysql> show variables like'character%'; +-----------…