Python實現手機號自動判斷男女性別

2021-10-01 15:14:51 字數 4099 閱讀 6167

男女判斷函式:

// an highlighted block

def numbe()

:ifexists

(template

(r"tpl1574867500094.png"

, threshold=

0.85

, rgb=true, target_pos=

0, record_pos=

(0.779

,0.382

), resolution=

(960

,540))

):*** =

"女"if

exists

(template

(r"tpl1574924960910.png"

, threshold=

0.89

, rgb=true, target_pos=

5, record_pos=

(0.779

,0.382

), resolution=

(960

,540))

):*** =

"男"else

: *** =

"不存在"

name*** = ***

keyevent

("4"

)return name***

手機滑動(根據手機解析度自行調整):

// an highlighted block

def scoll()

:try

:swipe

(v1=

(629

,1750

),v2=

(629

,310

)) # 滑動距離需要根據手機解析度自行調整

except:

print

("can't go back to the main page"

)

刷選函式:

// an highlighted block

def number()

:

data_list =

for i in

range(9

): # 根據手機解析度自行調整

try: title =

poco

(name=

)[i]

.get_text()

name =

poco

(name=

)[i]

.get_text()

print

(title)

name_a =name[5:

6]if title not in data_list and name_a is not "1"

:poco()

[i].

click

()

***name=

numbe()

if ***name ==

"男":

print

(str

(***name)

)else

:print

(str

(***name)

)else

:print

(name_a)

print

("不存在"

) except:

print

("出錯,跳過!"

)

綜合:

// an highlighted block

# -*

- encoding=utf8 -*-

__author__ =

"liuqingsong"

def numbe()

:ifexists

(template

(r"tpl1574867500094.png"

, threshold=

0.85

, rgb=true, target_pos=

0, record_pos=

(0.779

,0.382

), resolution=

(960

,540))

):*** =

"女"if

exists

(template

(r"tpl1574924960910.png"

, threshold=

0.89

, rgb=true, target_pos=

5, record_pos=

(0.779

,0.382

), resolution=

(960

,540))

):*** =

"男"else

: *** =

"不存在"

name*** = ***

keyevent

("4"

)return name***

def scoll()

:try

:swipe

(v1=

(629

,1750

),v2=

(629

,310

)) # 滑動距離需要根據手機解析度自行調整

except:

print

("can't go back to the main page"

)def number()

:

data_list =

for i in

range(9

): # 根據手機解析度自行調整

try: title =

poco

(name=

)[i]

.get_text()

name =

poco

(name=

)[i]

.get_text()

print

(title)

name_a =name[5:

6]if title not in data_list and name_a is not "1"

:poco()

[i].

click

()

***name=

numbe()

if ***name ==

"男":

print

(str

(***name)

)with

open

(r'./new/男.csv'

,'a'

,encoding=

'utf-8'

)as f:

f.write

("{},{}\n"

.format

(title,***name)

)else

:print

(str

(***name)

)with

open

(r'./new/女.csv'

,'a'

,encoding=

'utf-8'

)as f:

f.write

("{},{}\n"

.format

(title,***name)

)else

:print

(name_a)

print

("不存在"

) except:

print

("出錯,跳過!")a=

0while a<

5:#根據手機上號碼量的多少自行選擇

number()

scoll()

sleep(1

) a=a+

1

手機號判斷

public class smsutil toast.maketext activity,手機號碼輸入有誤!toast.length short show return false 驗證手機格式 public static boolean ismobileno string mobilenums 1...

python 生成手機號,並且驗證手機號是否存在

1 該功能需要兩個庫,random和phone 2 已移動手機號為例,首先匯入需要的庫,然後定義乙個類,在init裡定義移動手機號的字首,self.yd裡的手機號前三位都是屬於移動的。coding utf 8 import random from phone import phone class c...

python 手機號驗證

import re 驗證手機號是否正確 phone pat re.compile 13 d 14 5 7 15 d 166 17 3 6 7 18 d d while true input 和 raw input 這兩個函式均能接收 字串 但 raw input 直接讀取控制台的輸入 任何型別的輸入...