随笔分类 - python
摘要:server client
        阅读全文
            
摘要:# -*- coding: UTF-8 -*- import gevent from gevent import socket from gevent import event rev=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) rev.bind(('',53)) ip=[] cur=0 def preload(): f...
        阅读全文
            
摘要:from win32com import client import time import random from lxml import etree dirver = client.DispatchEx("InternetExplorer.Application") dirver.Navigate('http://sbj.saic.gov.cn/sbcx/') dirver.Visibl...
        阅读全文
            
摘要:#!/usr/bin/env python #coding=utf-8 import rospy from std_msgs.msg import String i=0 def talker(): global i pub = rospy.Publisher('bp_nav_goal',String, queue_size=10) rospy.init_node('...
        阅读全文
            
摘要:Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the thr
        阅读全文
            
摘要:class Solution(object): def threeSum(self, nums): res = [] nums.sort() for i in xrange(len(nums)-2): if i > 0 and nums[i] == nums[i-1]: conti...
        阅读全文
            
摘要:note:All given inputs are in lowercase letters a-z.
        阅读全文
            
摘要:class Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ lista={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000} Valu...
        阅读全文
            
摘要:class Solution(object): def intToRoman(self, num): """ :type num: int :rtype: str """ if num == 0: return "" if num >= 1000: ...
        阅读全文
            
摘要:def solution(num): if(0<num<=5): if(num<4): return (num)*"I" else: return (5-num)*"I"+"V" elif(5<num<=10): return "V"+(num-5)*"I" elif(10...
        阅读全文
            
摘要:class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ s=str(x) if(s==s[::-1]): return True els...
        阅读全文
            
摘要:def solution(s): s=s.strip() if(s): l=len(s) first_n=-1 b_n=-1 last_n=-1 f_n=-1 for i in range(l): if(s[i].isdigit()): ...
        阅读全文
            
摘要:def get_f_l(s_length,s,list_all,last_d): max_l=0 first_d=0 last_d=0 for i in range(len(list_all)): if((i+1)==len(list_all)): break for j in range(i+1,len...
        阅读全文
            
摘要:class Solution(object): def get_f_l(self,s_length,s,list_all,last_d): max_l=0 first_d=0 last_d=0 for i in range(len(list_all)): if((i+1)==len(list_al...
        阅读全文
            
摘要:list_all=[] oper_s="abcdaaaa" i_num=0 while(True): x=oper_s.find("a",i_num) print(x) if(not x==-1): i_num=x+1 list_all.append(x) else: break print(list_...
        阅读全文
            
摘要:class Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ p=abs(x) rev=int(str(p)[::-1]) if(x(pow(2,31)-1)): ...
        阅读全文
            
摘要:def solution(s): max_len=0 f=0 l=0 s_x=set(s) for i in s_x: first_d=s.find(i) last_d=s.rfind(i) if(first_d==last_d): pass else: ...
        阅读全文
            
摘要:print('{},{}'.format('chuhao',20))
        阅读全文
            
摘要:转为string类型
        阅读全文
            
                    
                
浙公网安备 33010602011771号