python
丧尽天良的良!
Java小白,,。
展开
-
python unicode汉字转成各种进制,以及进制互相转换
例如,汉字:“五”的unicode编码为:4e94,使用二进制的结果为:100111010010100,转换为十进制是:20116对应转换如下:原创 2021-01-11 09:51:01 · 1379 阅读 · 0 评论 -
python中的转义字符‘\’
转义字符: \反斜杠,在Java和python中都为转义字符常用的转义字符:换行:\n回车:\r水平制表符:\t退格:\bprint('hello\nworld')print('hello\tworld')print('helloo\tworld') #一个\t是四个字符的位置,如果刚好4个字符,那么重新开一个制表位,否则,制表位就是4-字符数print('hellooo\tworld')print('helloooo\tworld')print('hellooooo\tw原创 2021-01-06 10:43:32 · 12111 阅读 · 5 评论 -
python将文本内容写到文件中
将文本内容写到文件’/Users/luchenguang/Desktop/text.txt’中,如果文件不存在,那么新建,如果文件存在,则直接换行写入内容:helloworld a+的作用,相当于Java中的append。### 将文件输出到文件fp=open('/Users/luchenguang/Desktop/text.txt','a+')print('helloworld',file=fp)fp.close()...原创 2021-01-06 10:36:28 · 1975 阅读 · 0 评论