import time
t = 10
time.sleep(t)
This is an example. I need to put str in time.sleep() but it gives me Attribute error: "str" object has no attribute "sleep"
Type cast your string via int(my_str_time)
. Though this may be a hint that sitting through a python tutorial will be extremely useful.
It must be converted to an int.
new_t = int(t)
time.sleep(new_t)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.