Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想创建一个以 100 毫秒间隔发出事件的可观察对象。
我尝试使用rx.interval:
rx.interval
import rx tick = rx.interval(100) tick.subscribe(on_next=lambda i: print(i))
该过程未运行并提供一次性作为输出:
<rx.disposable.disposable.Disposable object at 0x7f7eac712dd8>
我怎样才能完成这项工作?
间隔以秒为单位。所以这很好用:
rx.interval(0.1).subscribe(on_next=lambda i: print(i))