小编use*_*661的帖子

重叠正则表达式

我想要一个匹配任何数字集的正则表达式,一个可能的点.如果后面有另一个点和更多数字,请与前一个数字,点和后面的数字重叠匹配.
示例string = 'aa323aa232.02.03.23.99aa87..0.111111.mm'
desired results =[323, 232.02, 02.03, 03.23, 23.99, 87, 0.111111]

目前使用:

import re
i = 'aa323aa232.02.03.23.99aa87..0.111111.mm'
matches = re.findall(r'(?=(\d+\.{0,1}\d+))', i)
print matches  
Run Code Online (Sandbox Code Playgroud)

输出:

['323', '23', '232.02', '32.02', '2.02', '02.03', '2.03', '03.23', '3.23', '23.99', '3.99', '99', '87', '0.111111', '111111', '11111', '1111', '111', '11']
Run Code Online (Sandbox Code Playgroud)

python regex

10
推荐指数
1
解决办法
174
查看次数

CSS 旋转动画停在原地

我有触发轨道动画的 .orbit 类。我删除了该类以停止轮换。这会将元素重置为其原始位置。

有没有办法停止旋转动画,将元素留在原来的位置?

目前正在获取位置并将其设置为该位置,但并不完美。

https://jsfiddle.net/f4hnz2va/2/

#errordot{
    position:absolute;
    top:0;
    left:0;
    width:50px;
    height:50px;
    background:red;
    border-radius:50%;
    font-size:40px;
}
#errorsun{
    width:200px;
    height:200px;
    position:absolute;
    top:50px;
    left:50px;
}
.orbit {
    -webkit-animation-iteration-count:infinite;
    -webkit-animation-timing-function:linear;
    -webkit-animation-name:orbit;
    -webkit-animation-duration:5s;
}

@-webkit-keyframes orbit {
from { -webkit-transform:rotate(0deg) }
to { -webkit-transform:rotate(360deg) }
}
@-moz-keyframes orbit {
from { -moz-transform:rotate(0deg) }
to { -moz-transform:rotate(360deg) }
}
Run Code Online (Sandbox Code Playgroud)

css

3
推荐指数
1
解决办法
5484
查看次数

logging.handlers.SMTPHandler引发smtplib.SMTPAuthenticationError

我用Verizon和Gmail试过这个.两台服务器都拒绝认证 Gmail通过电子邮件通知我它拒绝登录尝试,因为连接没有使用"现代安全".
我想知道如何使用这个日志记录处理程序的现代安全性.

logging.handlers.SMTPHandler(mailhost=('', 25),
                             fromaddr='',
                             toaddrs='',
                             subject='',
                             credentials=('username','password'),
                             secure=())
Run Code Online (Sandbox Code Playgroud)

python logging smtp

2
推荐指数
2
解决办法
2644
查看次数

不要使用已删除的主键

插入ID 1和2。删除ID2。插入新行,它的ID为2,而不是3。我该如何更改?我不想重用主键。

import sqlite3, os

os.remove('mydatabase.db')
conn = sqlite3.connect("mydatabase.db") # or use :memory: to put it in RAM
cursor = conn.cursor()

# create a table
cursor.execute("CREATE TABLE if not exists albums (id INTEGER PRIMARY KEY NOT NULL, title text, artist text, release_date text, publisher text, media_type text)")
cursor.execute("CREATE TABLE if not exists anti (id INTEGER, title text, artist text, release_date text, publisher text, media_type text)")
conn.commit()

cursor.execute("INSERT INTO albums VALUES (null, 'Glow', 'Andy Hunter', '7/24/2012', 'Xplore Records', 'MP3')")
cursor.execute("INSERT INTO …
Run Code Online (Sandbox Code Playgroud)

python sqlite primary-key

2
推荐指数
1
解决办法
143
查看次数

正则表达式| 如果存在,则停止

我需要一个正则表达式来匹配everything(任何字符)中的:
everything.html
everything
匹配.+.html字符串的末尾。
.html是可选的,但如果它存在,停止匹配。

python regex

-4
推荐指数
1
解决办法
701
查看次数

标签 统计

python ×4

regex ×2

css ×1

logging ×1

primary-key ×1

smtp ×1

sqlite ×1