使用fabric python正则表达式的mysql用户权限

使用fabric python正则表达式的mysql用户权限,python,regex,Python,Regex,可能重复: 正在尝试使用fabric设置mysql用户权限 有什么想法吗?非常感谢 run('mysql -u %s -p%s -e "grant all on %s.* to '%s\'@\'localhost' identified by 'PASSWORD'"' % (user, dbpasswd, account, account)) SyntaxError: unexpected character after line continuation character 尝试将您的线

可能重复:

正在尝试使用fabric设置mysql用户权限

有什么想法吗?非常感谢

run('mysql -u %s -p%s -e "grant all on %s.* to '%s\'@\'localhost' identified by 'PASSWORD'"' % (user, dbpasswd, account, account))

SyntaxError: unexpected character after line continuation character

尝试将您的线路更改为:

run('mysql -u %s -p%s -e "grant all on %s.* to \'%s\'@\'localhost\' identified by \'PASSWORD\'"' % (user, dbpasswd, account, account))

看看stackoverflow为您所做的语法,您将看到字符串的结束处是颜色的变化。