没有合适的资源?快使用搜索试试~ 我知道了~
首页Python 黑魔法指南 v1.0
网络上的Python学习资料,资深程序员的经验笔记、技巧结晶,非常有参考价值,欢迎大家下载! 书名叫做《Python 黑魔法手册》,该手册的作者(明哥)是一个从事云计算多年的 Python 重度用户,它把自已多年的 Python 编码经验整理成小册子,没有长篇大论,半天就能全能掌握,让你一天就能收获别人一年的技能及冷知识。 这本书的关键词有三个:够魔幻、够冷门、够好用
资源详情
资源评论
资源推荐

v1.0
20200512
Python
wongbingming@163.com
Githubhttps://github.com/iswbm/magic-python
...
Python
01.

>>> ...
Ellipsis
>>> type(...)
<class 'ellipsis'>
...
>>> Ellipsis
Ellipsis
>>> type(Ellipsis)
<type 'ellipsis'>
>>>
>>> bool(...)
True
>>> id(...)
4362672336
>>> id(...)
4362672336
$ cat demo.py
def func01():
...
def func02():
pass
func01()

func02()
print("ok")
$ python3 demo.py
ok
__builtins__.end = None
def my_abs(x):
if x > 0:
return x
else:
return -x
end
end
print(my_abs(10))
print(my_abs(-10))
[root@localhost ~]$ python demo.py
10
10
02. end
03. zip

[root@localhost ~]# ls -l demo
total 8
-rw-r--r-- 1 root root 30 May 8 19:27 calc.py
-rw-r--r-- 1 root root 35 May 8 19:33 __main__.py
[root@localhost ~]#
[root@localhost ~]# cat demo/__main__.py
import calc
print(calc.add(2, 3))
[root@localhost ~]#
[root@localhost ~]# cat demo/calc.py
def add(x, y):
return x+y
[root@localhost ~]#
[root@localhost ~]# python -m zipfile -c demo.zip demo/*
[root@localhost ~]#
[root@localhost ~]# python demo.zip
5
[root@localhost ~]#
\
[root@localhost ~]$ cat demo.py
print("hello "\
"world")
04. :

[root@localhost ~]$
[root@localhost ~]$ python demo.py
hello world
>>> str1='\nhello'
>>> print(str1)
hello
>>> str2='\thello'tab
>>> print(str2)
hello
\
>>> str3="\"
File "<stdin>", line 1
str3="\"
^
SyntaxError: EOL while scanning string literal
>>> str3=r"\"
File "<stdin>", line 1
str3=r"\"
^
SyntaxError: EOL while scanning string literal
05. for
剩余57页未读,继续阅读














安全验证
文档复制为VIP权益,开通VIP直接复制

评论0