擅长:python、mysql、java
<p>我试过了,希望这就是你想要的:</p>
<pre><code>spam= ['apples', 'bananas', 'tofu', 'cats']
def list_thing(list):
#creating a string then splitting it as list with two items, second being last word
new_string=', '.join(list).rsplit(',', 1)
#Using the same method used above to recreate string by replacing the separator.
new_string=' and'.join(new_string)
return new_string
print(list_thing(spam))
</code></pre>