python-3.x - 令人困惑的线程输出
问题描述
这段代码在不同的平台上给了我三种不同的输出
在在线 ide 上,输出是这个 https://www.online-python.com/AZ2Ggs35KU
在 IDLE 上的本地机器上,输出是这样的
嘿3
跑
但根据我研究过的概念,输出应该是
嘿
2
跑
import threading
import time
def demo_func():
print("hey")
time.sleep(1)
print("run")
t1 = threading.Thread(target = demo_func)
t1.start()
print(threading.activeCount())
解决方案
推荐阅读
- flutter - Flutter 中的所有小部件都具有“bool this.mounted”属性吗?
- java - 使用 Maven 将资源中的特定属性复制到战争的 WEB-INF
- web-services - 在 Swift 5 中使用 UIGraphicsImageRenderer 为 PDF 图像着色
- python - 在python中生成截断的负二项分布
- c++ - 零规则 - 未生成默认构造函数
- android - 如何使用whenNew powermockito在android中模拟PackageInfo
- r - R:使用 dplyr 在整个数据框中查找和过滤字符串
- reactjs - 为什么我的样式组件关键帧错误与 ts-styled-plugin(9999) 在使用百分比而不是 TO/FROM 时做出反应
- c# - 在 C# 中,将所有单独引用的类重写为结构是一种相当大的方法吗?
- php - 带有 laravel 计划的弹性 beanstalk cron