11. code-file

有些时候需要显示的代码来自某个文件或者某个url,以及显示出两个文件的差异

11.1. 引用一个文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import sys
    print("test")

def test2():
    print("test")

def test3():
    print("test")

def test4():
    print("test")

11.2. diff2个文件

--- /home/docs/checkouts/readthedocs.org/user_builds/rstd/checkouts/latest/_static/test2.py
+++ /home/docs/checkouts/readthedocs.org/user_builds/rstd/checkouts/latest/_static/test.py
@@ -1,12 +1,13 @@
 import sys
-import os
 
 def test1():
-    print("test3")
+    print("test")
 
 def test2():
-    print("test2")
+    print("test")
 
+def test3():
+    print("test")
 
 def test4():
-    print("test4")+    print("test")