摘要: list结构 list1 = ['i1', 'i2', 'i3', 'i4', 'i5'] print(list1) print(list1[2]) # 通过索引来访问列表 print(list1[0:2]) # 通过方括号的形式来截取列表中的数据,从下标0开始打印到下标2(不包括2) print( 阅读全文
posted @ 2021-12-08 22:22 ayanyuki 阅读(125) 评论(0) 推荐(0)
摘要: 字符串操作 """ 字符串常用操作 """ import json str1 = 'hello, world!' str2 = 'HELLO, WORLD!' print('字符串的长度是:', len(str1)) print('单词首字母大写: ', str1.title()) print('字 阅读全文
posted @ 2021-12-08 21:41 ayanyuki 阅读(84) 评论(0) 推荐(0)
摘要: 输入输出以及运算 print('hello, world!') # print("你好,世界!") print('你好', '世界') print('hello', 'world', 'world', sep=', ', end='!') print('goodbye, world', end='! 阅读全文
posted @ 2021-12-08 21:39 ayanyuki 阅读(104) 评论(0) 推荐(0)
摘要: 一个简单的例子 def print_hi(name): print(f'Hi, {name}') if __name__ == '__main__': print_hi('PyCharm') 阅读全文
posted @ 2021-12-08 20:50 ayanyuki 阅读(30) 评论(0) 推荐(0)
摘要: replace函数 #include<iostream> #include<string> using namespace std; int main(){ string str = "he is@ a@ good boy"; cout << str << endl; str = str.repla 阅读全文
posted @ 2021-12-08 20:35 ayanyuki 阅读(188) 评论(1) 推荐(0)