Ulipad, looking very comfortable.
The code in the diagram is the result of this evening.
All of a sudden I wanted to see Python, a language that many people say is elegant, so that at night it's all about matching the environment and doing something
1 #Encoding:utf-82 ImportUrllib3 ImportUrllib24 5 #Name: Names to register6 #determine if name is available7 deftestusername (name):8Url="http://passport.hupu.com/index.php"9params={'m':'User','a':'Isusername','username': Name}Tendata1=Urllib.urlencode (params) Onereq=Urllib2. Request (URL,DATA1) AResponse=Urllib2.urlopen (req) -res=Response.read () -Status=eval (RES) ['Code'] the ifstatus=='1': - returnTrue - returnFalse - + #path: File name - #read the name in the file and return the unregistered name in the file + defshowuseablename (path): A atList_name=[] -file=Open (Path) - forLineinchFile: -Line=line.strip ('\ n') -Line=line.decode ('GBK'). Encode ('UTF8') - ifTestusername (line): in List_name.append (line) - returnList_name to + -Items=showuseablename ('List.txt') the forIteminchItems: * PrintItem.decode ('UTF8'). Encode ('GBK') $Raw_input ()
The user name in the List.txt will be read to detect registration, if not registered, it will be displayed.
Python is graceful and not graceful, but it's pretty comfortable.
Python Tiger flutter registration check script