![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python代码
薄荷叶汁
不会就学呗
展开
-
python练习代码01
print('hello,world!','100+100',20-2,'aa'+'a')显示hello,world! 100+100 18 aaa原创 2019-08-21 14:33:44 · 743 阅读 · 0 评论 -
python练习代码11
'a test module'__author__ = 'dzs'import sysdef test(): args = sys.argv if len(args)==1: print('hello world!') elif len(args)==2: print('hello %s'% args[1]) else: ...原创 2019-09-02 19:42:26 · 805 阅读 · 0 评论 -
python练习代码10
a = list(map(str,[1,2,3,4,5,6]))print(list(map(str,[1,2,3,4,5,6])))print(map(str,[1,2,3,4,5,6]))print(a)from functools import reducedef add(x,y): return x + yprint(add,[2,2,2])print(reduce...原创 2019-08-29 17:10:24 · 697 阅读 · 0 评论 -
python练习代码09
print([x*x for x in range(1,11)])print([x*x for x in range(1,11)if x % 2 == 0])print([m + n for m in 'ASD' for n in 'zxc'])d = {'x':'A','y':'B','z':'C'}for k, v in d.items(): print('%s = %s'%(...原创 2019-08-29 14:02:00 · 887 阅读 · 0 评论 -
python练习代码08
切片/函数L = ['a','b','c','d','e','f']print(L[0:3])print(L[:2])print(L[-2:-1])print(L[-2:])print(L[1:])print(L[::2])print(L[::3])print(L[0:0])print(L[2:-1])print(L[:])x = input('x :')y...原创 2019-08-29 10:40:17 · 778 阅读 · 0 评论 -
python练习代码07
# int 整型/str 字符串/float 浮点数/ list 列表/tuple 元组/dict 字典/set 集合a = input('plz input a string ')if isinstance(a,int): print('is int')elif isinstance(a,str): print('is str')else: print('is...原创 2019-08-23 14:54:56 · 830 阅读 · 0 评论 -
python练习代码06
classmate = ['alex','bob','coco']print(len(classmate))print(classmate[0])classmate.append('adam')print(classmate)classmate.insert(1,'bill')print(classmate)classmate.pop()print(classmate)clas...原创 2019-08-21 16:58:49 · 809 阅读 · 1 评论 -
python练习代码05
代码username = input('plz input your username : ')password = input('plz input your password : ')print('your username.length is %d ,your password.length is %d'%(len(username),len(password)))# len函数可以...原创 2019-08-21 15:24:40 · 836 阅读 · 0 评论 -
python练习代码04
代码print('Hello,%s'%'world')print('Hi,%s,you have $%d'%('Jack',10))a = input('input a ')b = input('input b ')b = int(b)print('Hi,%s,you have $%d'%(a,b))显示Hello,worldHi,Jack,you have $10inp...原创 2019-08-21 14:46:11 · 666 阅读 · 0 评论 -
python练习代码03
代码print('i\'m \'ok\'')print('a\na')print('a\ta')print('a\\a')print(r'\n \t \\')print('''aaabbba\\aAAAAAAccc''')print(r'''aaabbba\\aAAAAAAccc''')x=10x=x+2print(x)显示i'm 'o...原创 2019-08-21 14:44:13 · 684 阅读 · 0 评论 -
python练习代码02
代码name = input('plz,enter your name : ')print('11111111')print('hello',name)print('22222222222')print('2*4=',2*4)a = input('this is a :')b = input('this is b :')a = int(a)b = int(b)print('a+...原创 2019-08-21 14:41:56 · 662 阅读 · 0 评论 -
python练习代码12
# -*- coding:utf-8 -*-import urllibimport requestsimport reimport os def getHtml(url): html = requests.get(url).text #requests.get(url) 拿到这个网址的信息 .text 则是把网页信息以文本形式输出 # urls = r...原创 2019-09-11 19:35:47 · 122 阅读 · 0 评论