Category: Python

  • python web scraping

    https://blog.csdn.net/qq_37616069/article/details/80376576

  • for loop

    Mine002 x=[5,2,5,2,2] for y in x: print( ‘x’*y )

  • Program 001

    mine1 car_sta=’park’ command=input(‘>’) while command !=’quit’: if command == ‘help’: print(”’ start – to start car stop – to stop car quit – to quit the game”’) command=input(‘>’) elif command==’stop’ and car_sta==’park’: print(‘car is not running yet’) command=input(‘>’) elif command==’stop’ and car_sta==’run’: print(‘car stopped’) car_sta=’park’ command=input(‘>’) elif command==’start’ and car_sta==’park’: print(‘car is running now!’) car_sta=’run’…

  • Python 001

    在代码世界中,赋值符号=不是左边等于右边的意思。仅仅表示赋值动作:把右边的内容放到了左边的盒子中。代表左右两边相等的符号,是比较运算符== print(”’ へ     /|   /\7    ∠_/   / │   / /  │ Z _,< /   /ヽ │     ヽ   /  〉 Y       /  /  イ● 、 ●  ⊂⊃〈  /  ()  へ    | \〈   >ー 、_  ィ  │ //   / へ   / ノ<| \\   ヽノ  (/  │//   7       |/   >―r ̄ ̄`ー―_”’) Python里,最常用的数据类型有三种——字符串(str)、整数(int)和浮点数(float) ; 只要是被【单/双/三引号】这层皮括起来的内容,不论那个内容是中文、英文、数字甚至火星文。只要是被括起来的,就表示是字符串类型。 整数,整数英文为integer,简写做int。Python世界的整数其实和现实世界数学中定义的一样:是正整数、负整数和零的统称,是没有小数点的数字。 浮点数的英文名是float,与整数(int)和字符串(str)不同,浮点数没有简写。 浮点数非常好识别,它比整数多了一个小数点『.』,比如下列代码中的数字都是浮点数。 利用字符串拼接符号【+】 type(); str(); int(); float() 153=1x1x1+5x5x5+3x3x3是个水仙花数。 首先,整数形式的字符串比如’6’和’1’,可以被int()函数强制转换。其次,文字形式,比如中文、火星文或者标点符号,不可以被int()函数强制转换。最后,小数形式的字符串,由于Python的语法规则,也不能使用int()函数强制转换。 浮点数是可以被int()函数强制转换的。 print(‘$’*10)-> $$$$$$$$$$$