This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gwith@Gwith-PC:~$ python3 | |
| Python 3.5.2 (default, Jul 5 2016, 12:43:10) | |
| [GCC 5.4.0 20160609] on linux | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> import pyperclip | |
| >>> pyperclip.copy('Hello world!') | |
| >>> pyperclip.paste() | |
| 'Hello world!' | |
| [2]+ Stopped python2 | |
| gwith@Gwith-PC:~$ python |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gwith@Gwith-PC:~/Documents$ python test.py | |
| gwith@Gwith-PC:~/Documents$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gwith@Gwith-PC:~/Documents$ python test.py | |
| gwith@Gwith-PC:~/Documents$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test1 = { 'cat' : 1, 'dog' : 1, 'bird' : 1} | |
| test2 = { 'cat' : 3, 'dog' : 2, 'cow' : 2 } | |
| for key in test2: | |
| test1[key] = test1.get(key, 0) + test2[key] | |
| print(test1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tableData = [['apples', 'oranges', 'cherries', 'banana'], | |
| ['Alice', 'Bob', 'Carol', 'David'], | |
| ['dogs', 'cats', 'moose', 'goose']] | |
| def printTable(tableData): | |
| colWidths = [0] * len(tableData) | |
| for i in tableData: | |
| for j in i: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import netmiko | |
| #.hp import HPProcurveSSH, HPComwareSSH | |
| hp_procurve = { | |
| 'device_type': 'hp_procurve', | |
| 'ip': '192.168.x.x', | |
| 'username': 'test', | |
| 'password': '1234', | |
| 'port': 22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tableData=[['apples', 'oranges', 'cherries', 'banana'], | |
| ['Alice', 'Bob', 'Carol', 'David'], | |
| ['dogs', 'cats', 'moose', 'goose']] | |
| newTable = { 0:[], 1:[], 2:[], 3:[] } | |
| for list in tableData: | |
| for element in range(len(list)): | |
| newTable[element].append(list[element]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Calculate when user will be 100 years old | |
| import datetime #import datetime to grab year. | |
| def age(): | |
| name = input("What is your name?\n") #grab input of user 'name' | |
| name = name.replace(name[0], name[0].upper()) #replace first letter with capitol | |
| try: | |
| age = int(input("What is your age?\n")) #grab user age and change to int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Calculate when user will be 100 years old | |
| import datetime #import datetime to grab year. | |
| name = input("What is your name?\n") #grab input of user 'name' | |
| name = name.replace(name[0], name[0].upper()) #replace first letter with capitol | |
| age = 0 | |
| try: | |
| age = int(input("What is your age?\n")) #grab user age and change to int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Calculate when user will be 100 years old | |
| import datetime #import datetime to grab year. | |
| name = input("What is your name?\n") #grab input of user 'name' | |
| name = name.replace(name[0], name[0].upper()) #replace first letter with capitol | |
| age = 0 | |
| while True: |