摘要: setp = set(["Red", "Green"]) setq = setp.copy() print(setq) setp.clear() print(setq) 阅读全文
posted @ 2018-11-12 22:37 anobscureretreat 阅读(1363) 评论(0) 推荐(0)
摘要: #A new empty set color_set = set() color_set.add("Red") print(color_set) #Add multiple items color_set.update(["blue","blue", "Green"]) print(color_set) 阅读全文
posted @ 2018-11-12 22:31 anobscureretreat 阅读(7716) 评论(0) 推荐(0)
摘要: #create a tuple l = [(1,2), (3,4), (8,9)] print(list(zip(*l))) 阅读全文
posted @ 2018-11-12 22:27 anobscureretreat 阅读(4588) 评论(0) 推荐(0)
摘要: #create a tuple tuplex = 4, 8, 3 print(tuplex) n1, n2, n3 = tuplex #unpack a tuple in variables print(n1 + n2 + n3) #the number of variables must be equal to the number of items of the tuple n1, n2... 阅读全文
posted @ 2018-11-12 22:25 anobscureretreat 阅读(551) 评论(0) 推荐(0)
摘要: #create a tuple tuplex = (2, 4, 3, 5, 4, 6, 7, 8, 6, 1) #used tuple[start:stop] the start index is inclusive and the stop index _slice = tuplex[3:5] #is exclusive print(_slice) #if the start index ... 阅读全文
posted @ 2018-11-12 22:22 anobscureretreat 阅读(1907) 评论(0) 推荐(0)
摘要: #create a tuple x = ("w3resource") # Reversed the tuple y = reversed(x) print(tuple(y)) #create another tuple x = (5, 10, 15, 20) # Reversed the tuple y = reversed(x) print(tuple(y)) 阅读全文
posted @ 2018-11-12 22:20 anobscureretreat 阅读(2221) 评论(0) 推荐(0)
摘要: #create a tuple tuplex = "w", "j" ,"c", "e" print(tuplex) #tuples are immutable, so you can not remove elements #using merge of tuples with the + operator you can remove an item and it will create ... 阅读全文
posted @ 2018-11-12 22:17 anobscureretreat 阅读(3907) 评论(0) 推荐(0)
摘要: 编译指定包 使用上述命令后catkin_make会一直编译上面那个包,想要编译全部包,使用 阅读全文
posted @ 2018-11-12 21:18 anobscureretreat 阅读(384) 评论(0) 推荐(0)
摘要: sudo apt-get install ros-kinetic-robot-pose-publisher 阅读全文
posted @ 2018-11-12 21:15 anobscureretreat 阅读(792) 评论(0) 推荐(0)
摘要: sudo apt-get install ros-kinetic-rosbridge-server 阅读全文
posted @ 2018-11-12 21:14 anobscureretreat 阅读(1239) 评论(0) 推荐(0)
摘要: 第一种 原因,/etc/hostname 中的hostname 与/etc/hosts 里面的不对应,导致无法解析 将两个文件的hostname改成一样的即可。 /etc/hostname /etc/hosts 第二种 或者:/etc/hosts 在127.0.0.1 localhost 后面加上主 阅读全文
posted @ 2018-11-12 19:35 anobscureretreat 阅读(528) 评论(0) 推荐(0)
摘要: #create a tuple tuplex = 2, 4, 5, 6, 2, 3, 4, 4, 7 print(tuplex) #return the number of times it appears in the tuple. count = tuplex.count(4) print(count) 阅读全文
posted @ 2018-11-12 10:41 anobscureretreat 阅读(828) 评论(0) 推荐(0)
摘要: #create a tuple tuplex = tuple("index tuple") print(tuplex) #get index of the first item whose value is passed as parameter index = tuplex.index("p") print(index) #define the index from which you w... 阅读全文
posted @ 2018-11-12 10:37 anobscureretreat 阅读(4204) 评论(0) 推荐(0)
摘要: from copy import deepcopy #create a tuple tuplex = ("HELLO", 5, [], True) print(tuplex) #make a copy of a tuple using deepcopy() function tuplex_clone = deepcopy(tuplex) tuplex_clone[2].append(50) ... 阅读全文
posted @ 2018-11-12 10:31 anobscureretreat 阅读(161) 评论(0) 推荐(0)
摘要: tup = ('e', 'x', 'e', 'r', 'c', 'i', 's', 'e', 's') str = ''.join(tup) print(str) 阅读全文
posted @ 2018-11-12 10:25 anobscureretreat 阅读(3961) 评论(0) 推荐(0)
摘要: #create a tuple tuplex = ((2, "w"),(3, "r")) print(dict((y, x) for x, y in tuplex)) 阅读全文
posted @ 2018-11-12 10:22 anobscureretreat 阅读(4371) 评论(0) 推荐(0)
摘要: #create a list l = [("x", 1), ("x", 2), ("x", 3), ("y", 1), ("y", 2), ("z", 1)] d = {} for a, b in l: d.setdefault(a, []).append(b) print (d) 阅读全文
posted @ 2018-11-12 10:17 anobscureretreat 阅读(992) 评论(0) 推荐(0)