>>> import re
>>> from urllib.request import urlopen
>>> regex = r"createObject\(\"Placemark\",\s?new\sYMaps\.GeoPoint\(([\d\s\.\,]+)\),\s?\"(\w+)\",\s?'([^']+)'\s?\);"
>>> text = str(urlopen("https://koleso.ru/shops/").read(),"windows-1251")
>>> result = [list(x.groups()) for x in re.finditer(regex, text, re.MULTILINE)]
>>> result[0]
['37.834803,55.776082', 'Koleso', '<div><a class="MenuNav_YmapsBalloonPreButton" style="font-size:11px;" href="/shops/3653118/">Карточка магазина</a></div><div class="MenuNav_YmapsBalloonComment"><b>г. Москва</b><br />ш. Энтузиастов, д. 63<br />тел.: +7(499)308-59-93</div>']
>>>
import wx
i=0
def Timer1(evt):
global text1,i
i+=1
text1.SetLabelText(str(i))
app = wx.App()
frame = wx.Frame(None, -1, 'win.py')
t1 = wx.Timer(frame)
t1.Start(1000)
panel = wx.Panel(frame, wx.ID_ANY)
text1 = wx.StaticText(panel, wx.ID_ANY, str(i), (50, 10))
frame.Bind(wx.EVT_TIMER, Timer1)
frame.Show()
frame.Centre()
app.MainLoop()
@app.route('/<str:name>.html')
def Loader(name):
if os.path.isfile(name+".txt"):
text = open(name+".txt","rb").read()
else:
text = "не найдено"
return render_template('ch.html', text=text)
<pre>{{ text }}</pre>
a,b,c,d = int(a),int(b),int(c),int(d) #на всякий случай сделаем натуральными
if 1<=a<=b and a<=b<=10 and 1<=c<=d and c<=d<=10:
pass
if a in range(1, int(b+1)) and b in range(int(a), 11) and c in range(1, int(d+1)) and d in range(int(с), 11):
pass
#!/usr/bin/env python
chmod +r myfile.py
l_1 = 3
l_2 = 4
l_3 = 5
hits = 0
guesses = 0
isSunk = False
while isSunk == False:
guess = int(input("На старт, внимание, огонь!(введите любое число от 0 до 6):"))
if guess < 0 or guess > 6:
print("Пожалуйста, введите коректную цифру")
else:
guesses += 1
if guess == l_1 or guess == l_2 or guess == l_3:
print("Попал!")
hits += 1
if hits == 3:
isSunk = True
print("Ты только что, потопил мой корабль!")
else:
print("Мимо!")
import json
data = json.loads("""[{'slot': -1, 'team': 2, 'time': 576.41, 'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'slot': -1, 'team': 2, 'time': 791.491, 'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'player_slot': 129,
'slot': 6,
'team': 3,
'time': 1187.728,
'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'player_slot': 4,
'slot': 4,
'team': 2,
'time': 1237.115,
'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'player_slot': 129,
'slot': 6,
'team': 3,
'time': 1366.95,
'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'slot': -1, 'team': 2, 'time': 1621.088, 'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'player_slot': 130,
'slot': 7,
'team': 3,
'time': 1655.347,
'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'player_slot': 132,
'slot': 9,
'team': 3,
'time': 1686.872,
'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'player_slot': 2,
'slot': 2,
'team': 2,
'time': 1751.123,
'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'player_slot': 4,
'slot': 4,
'team': 2,
'time': 1780.849,
'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'slot': -1, 'team': 3, 'time': 1927.636, 'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'player_slot': 129,
'slot': 6,
'team': 3,
'time': 2117.449,
'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'player_slot': 132,
'slot': 9,
'team': 3,
'time': 2156.047,
'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'key': '512', 'time': 2178.992, 'type': 'CHAT_MESSAGE_BARRACKS_KILL'},
{'player_slot': 4,
'slot': 4,
'team': 2,
'time': 2326.829,
'type': 'CHAT_MESSAGE_TOWER_KILL'},
{'key': '2', 'time': 2333.384, 'type': 'CHAT_MESSAGE_BARRACKS_KILL'}]""".replace("'",'"'))
for i,e in enumerate(data):
if e['type'] == 'CHAT_MESSAGE_BARRACKS_KILL':
print(data[i-1])