【python学习】字符串相关
# -*- coding: utf-8 -*-
# =============================================================================
# Ctrl + 1: 注释/反注释
#
# Ctrl + 4/5: 块注释/块反注释
#
# Ctrl + L: 跳转到行号
#
# Tab/Shift + Tab: 代码缩进/反缩进
# ============================================================================= for i in range(128):
print(chr(i).__repr__(),end=" ") print(type('a')) print("I'm the bone of my sword.\nSteel is my body and ...") print("chrom\tstart\tend\tstrand\tname\tscore")
print("chr1\t520000\t530000\t+\tgene1\t0")
print("\\") chr_, start, end = "chr1", 1000, 2000
tmpl = "gene1\nchromosome\t{}\nstart\t{}\nend\t{}"
# 这里定义了一个 模板,{} 占位处在 format 时会被替换
print(tmpl.format(chr_, start, end)) bs = b"this is a bytes"
print(type(bs))
print(bs) #s = "hello world"
#print(s)
#s.encode('utf-8').decode('utf-16')
#print(s) l1 = [1, "this is a str", 1.114, True]
print(l1[1:3])
result:

【python学习】字符串相关的更多相关文章
- Python学习————字符串相关操作
s.capitalize()-------首字母大写s.upper()------全大写s.lower()------全小写s.swapcase()---大小写翻转s.title()------每个隔 ...
- python中跟字符串相关的一些操作
公司让用python自动生成代码,以前没看过python.所以匆匆的看了两天python就连猜带蒙就上马开干了..因此好多操作可能看的时候看懂了,用的时候知道有这么个东西,具体用法就忘记了..用到了就 ...
- python学习--字符串
python的字符串类型为str 定义字符串可以用 ‘abc' , "abc", '''abc''' 查看str的帮助 在python提示符里 help(str) python基于 ...
- python学习-字符串 列表 元祖
目录 Python翻转字符串(reverse string) 简单的步长为-1, 即字符串的翻转(常用) 递归反转 借用列表,使用reverse()方法 字符串常用操作 index split 切片 ...
- python学习——字符串
1)字符串解释 字符串是python中常用的数据类型我们可以使用" "或' '来创建字符串. 2)字符串操作 """访问字符串中的值"&qu ...
- python学习-字符串前面添加u,r,b的含义
引用:https://www.cnblogs.com/cq90/p/6959567.html u/U:表示unicode字符串 不是仅仅是针对中文, 可以针对任何的字符串,代表是对字符串进行unico ...
- Python学习---字符串处理
This world is but a canvas to our imagination. 世界只是我们的想象的画布. ----Apri 22 ''' 题目内容: "Pig Latin&q ...
- Python学习的相关文件链接
1.如何用 Python 模糊搜索文件 用循环来实现逐个比对,素材链接:https://files.cnblogs.com/files/Lamfai/script_project1_files. ...
- Python学习--字符串slicing
Found this great table at http://wiki.python.org/moin/MovingToPythonFromOtherLanguages Python indexe ...
- Python学习---字符串操作
### 截取字符串然后拼接 str = "Hello World!" str2 = str[:6] + "tyche !" print(str2) ===> ...
随机推荐
- 基于EPICS实现西门子S7通信
(1) EPICS官网下载Demo并复制文件到指定位置 (2) 创建Modules文件夹,wget https://epics.anl.gov/download/modules ...
- 使用iview 的表单组件验证 Upload 组件
使用iview 的表单组件验证 Upload 组件 结果: 点击提交按钮, 没有填的form 项, 提示错误, 当填入数据后提示验证成功 代码: <template> <div id ...
- 北京化妆时尚气息自适应CSS例子
三里屯太古广场——北京化妆时尚气息的先锋阵地! “乐色起义”创意化妆设计大赛——国内最具创意的公益设计大赛! CNature——国内最具个性的时尚环保公益组织! 一个多么奇妙的组合!就在2010年的这 ...
- css 规范标签
页头:header 登录条:loginBar 标志:logo 侧栏:sideBar 广告:banner 导航:nav 子导航:subNav 菜单:menu 子菜单:subMenu 搜索:search ...
- no input file specified 三种解决方法
一.IIS Noinput file specified 方法一:改PHP.ini中的doc_root行,打开ini文件注释掉此行,然后重启IIS 方法二: 请修改php.ini 找到 ; cgi.f ...
- Boston Key Party 2015 Heath Street 题解(Writeup)
Heath Street是Boston Key Party 2015的一道数字取证题目,我们得到了一个叫做“secretArchive.6303dd5dbddb15ca9c4307d0291f77f4 ...
- springboot中使用servlet通过配置类
在servlet目录下创建个servlet类,示例代码如下: package com.bjpowernode.springboot.servlet; import javax.servlet.Serv ...
- win10上使用自带的Hyper-V安装虚拟机
Hyper-V管理器,新建虚拟机,安装了.iso系统,但启动报错,电脑上联想G40-70,都说在bios设置的security里开启硬件虚拟化选项,可我security里没有虚拟化相关选项, 后来在 ...
- inode,软硬链接
如何查看inode ll -di /boot / /app查看文件和文件夹的inode号 df -i查看挂载点文件夹的inode号 做inode增长实验 创建60万个文件的方法1(效率不高):for ...
- 数组扩展运算符 -ES6
1.将数组转为以逗号分隔的序列 2.格式 ...[1,2,3 ] 3.若扩展运算符后面是一个空数组,则不产生效果[ ] 4.用于函数参数 function add(x,y) { console.log ...