更新时间:2023-02-23 10:00:19
states.split()
将返回
['Alaska',
'Alabama',
'Arkansas',
'American',
'Samoa',
'Arizona',
'California',
'Colorado']
如果你需要一个随机的,那么你必须使用 random
模块:
If you need one random from them, then you have to use the random
module:
import random
states = "... ..."
random_state = random.choice(states.split())