<分区> 分区>
在 python3 中我有例如以下字符串
433 65040 9322 /opt/conda/envs/python2/bin/python -m ipykernel_launcher
我想将其分成四部分:前三个元素(数字)和其余部分作为一个字符串。当然可以通过以下方式进行:
text = " 433 65040 9322 /opt/conda/envs/python2/bin/python -m ipykernel_launcher"
pid,rss,etime,*remainder = text.split()
cmd = ' '.join(remainder)
但也许有更 pythonic 的方式来做到这一点?
