在python中询问名字时如何才允许字母?

时间:2016-08-29 05:42:52

标签: python string input

我不熟悉python中的编码,需要知道如何只允许用户在输入名称时输入字母。因此,如果他们输入一个数字或根本不输入任何数字,我希望代码说出类似"请仅使用字母,再试一次"。

干杯克里斯

1 个答案:

答案 0 :(得分:7)

您要求的是DECLARE @FullStatement nvarchar(4000) SET @FullStatement= ' Using ' + @TargetTable+ ' AS itarget'+ ' USING '+@CurrentTable+' AS isource SELECT isource.[Address], itarget.[Address] FROM isource INNER JOIN itarget ON target.VersionEndDate IS NULL AND target.ResearchPropertyId = source.ResearchPropertyId AND -- Here Need a AND (coalesce(isource.[Address], '''') = coalesce(itarget.[Addres], '''')) and (coalesce(itarget.[Address], '''') = coalesce(isource.[Address], ''''))' IF @debug = 1 PRINT @FullStatement EXECUTE sp_executesql @FullStatement 功能:

str.isalpha()

例如,您可以像这样使用它:

isalpha(...)
   S.isalpha() -> bool

   Return True if all characters in S are alphabetic
   and there is at least one character in S, False otherwise.