其中Python strip() 方法用於移除字符串頭尾指定的字符
split()就是將一個字符串分裂成多個字符串組成的列表
>>> image ='1.jsp,2.jsp,3.jsp,4.jsp' >>> image_list = image.strip(',').split(',') >>> print image_list ['1.jsp', '2.jsp', '3.jsp', '4.jsp'] >>>
其中Python strip() 方法用於移除字符串頭尾指定的字符
split()就是將一個字符串分裂成多個字符串組成的列表
>>> image ='1.jsp,2.jsp,3.jsp,4.jsp' >>> image_list = image.strip(',').split(',') >>> print image_list ['1.jsp', '2.jsp', '3.jsp', '4.jsp'] >>>
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。