Просмотр исходного кода

【添加】基本类型模块示例

SummerGift 6 лет назад
Родитель
Сommit
28b82f3c71
2 измененных файлов с 41 добавлено и 0 удалено
  1. 21 0
      examples/basic/_thread.py
  2. 20 0
      examples/basic/uos.py

+ 21 - 0
examples/basic/_thread.py

@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2006-2019, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: MIT License
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2019-06-13     SummerGift   first version
+ */
+
+import _thread
+import utime as time
+
+def testThread():
+    while True:
+        print("Hello from thread")
+        time.sleep(2)
+
+_thread.start_new_thread(testThread, ())
+while True:
+    pass

+ 20 - 0
examples/basic/uos.py

@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2006-2019, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: MIT License
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2019-06-13     SummerGift   first version
+ */
+
+import uos
+
+uos.mkdir("rtthread")
+uos.getcwd()
+uos.chdir("rtthread")
+uos.getcwd()
+uos.listdir()
+uos.rmdir("11")
+uos.listdir()
+