Efficient way to convert strings from split function to ints in Python

后端 未结 4 1379
执笔经年
执笔经年 2020-12-02 20:08

I have a string of data with the following format: xpos-ypos-zoom (i.e. 8743-12083-15) that I want to split up and store in the variables xpos, ypos, and zoom. Since I need

4条回答
  •  囚心锁ツ
    2020-12-02 20:32

    efficient as in fewer lines of code?

    (xval,yval,zval) = [int(s) for s in file.split('-')]
    

提交回复
热议问题