我需要将日期值分解为它的元素(8/23/2011),这应该是一块蛋糕
variable.split("/")
Run Code Online (Sandbox Code Playgroud)
但它告诉我
'unicode' object has no attribute 'Split'
Run Code Online (Sandbox Code Playgroud)
我尝试将其编码为不同的格式:
date.encode("utf-8")
Run Code Online (Sandbox Code Playgroud)
然后它告诉我
'str' object has no attribute 'Split'
Run Code Online (Sandbox Code Playgroud)
作为Python的新手,似乎我之前使用过split with strings,但我没有把它变成正确的格式或其他东西.或许还有另一种方式更容易.