PythonHackingBook1 icon indicating copy to clipboard operation
PythonHackingBook1 copied to clipboard

Python黑客编程之极速入门

Results 18 PythonHackingBook1 issues
Sort by recently updated
recently updated
newest added

#2.2.1 标准整型和长整型 ``` a = 0o101 print("a="+str(a)) b=64 print('b='+str(b)) c=-237 print('c='+str(c)) d=0x80 print('d='+str(d)) e=-0x92 print('e='+str(e)) longint=34252456245724572456723 print('longint='+str(longint)) #1.2.2 布尔型和布尔对象 print(bool(1)) print(bool(True)) print(bool('0')) print(bool([])) print(bool((1,))) foo = 42 bar = foo...

#1.通过索引的方法 ``` print("list...") list1=[1,2,3,4,5,6,7,8,9,'du','ao','duaoge'] print(list1[::-1])

``` print("字符串...") str1='du','ao','ge','hello','word',"hello worde!" print("原数据为:",str1) print(str1[1:5]) str2=1,2,3 str1=str2+str1[3:]#将字符串前n个字符替换为指定的字符 print(str1)

``` def printRight(Username,Passwords): Prints the usernames and passwords. The two valuse should be right.''' if(Username=='seven'): if(Passwords==123): print("登陆成功!") else: print("登陆失败!") printRight('seven',123) printRight('seven',1234) print(printRight.__doc__) def printList(i,sum): '''Prints the two numbers. The if...

``` def add(a,b): return a+b def sub(a,b): return a-b def mult(a,b): return a*b def div(a,b): return a/b import zuoye a=12 b=13 print('a+b=',zuoye.add(a,b)) print('a-b=',zuoye.add(a,b)) print('a*b=',zuoye.mult(a,b)) print('a/b=',zuoye.div(a,b))

``` # 将1.4节的练习题的实现都封装到函数中,传入不同的参数进行调用测试 # 实现用户输入用户名和密码,当用户名为 seven且密码为123时,显示登陆成功,否则登陆失败! def login(Username,Password): while True: Username = str(input("请输入用户名")) Password = int(input("请输入密码")) if Username == str("seven") and Password == int("123"): print("成功登录") break Username = str(input("请输入用户名")) Password...

**Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll...