Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
bom_identify
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bbacc1f0
authored
Dec 29, 2020
by
lichenggang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加pre_judge function
parent
4a7088ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
utils/functions.py
utils/functions.py
0 → 100644
View file @
bbacc1f0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
def
is_float
(
s
):
xiaoshu_new
=
str
(
s
)
if
xiaoshu_new
.
count
(
"."
)
==
1
:
left
,
right
=
xiaoshu_new
.
split
(
"."
)
if
left
.
isdigit
()
and
right
.
isdigit
():
return
True
elif
left
.
startswith
(
'-'
)
and
left
.
count
(
'-'
)
==
1
and
right
.
isdigit
():
lleft
=
left
.
split
(
'-'
)[
-
1
]
if
lleft
.
isdigit
():
return
True
return
False
def
pre_judge
(
kw
):
if
is_float
(
kw
)
or
len
(
kw
)
==
1
or
kw
.
isdigit
()
or
len
(
kw
)
>=
30
:
return
False
return
True
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment