Howe."/> Howe."/> Howe"/>
خرید بک لینک

Vote count: 0

When I execute the following code:

import re
phoneNumRegex = re.compile("")
print(type(phoneNumRegex))

I get output:

<class '_sre.SRE_Patte'>

However, if I try and use type(phoneNumRegex) in an if statement, I need to parse it as a str for it to work as intended:

if str(type(phoneNumRegex)) == "<class '_sre.SRE_Patte'>":
    print("This if statemnt works")

Note how it reads str(type(phoneNumRegex)) above, not type(phoneNumRegex). My question is, why must I parse type(phoneNumRegex) as a str when I use it in an if statement?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 28 فروردين 1395 ساعت: 7:36

صفحه بندی