Linux Resolved

  • Home
Python Cheat Sheet - For loops

Python Cheat Sheet – For loops

Posted on December 2, 2017December 23, 2018 by Nikko
Run a for loop for each item in a list for variable in list_name: print variable Run a for loop for each item in a dictionary webster = { "Aardvark" : "A star of a popular children's cartoon show.", "... Read More
Python Cheat Sheet - Lists and Dictionaries

Python Cheat Sheet – Lists and Dictionaries

Posted on December 2, 2017December 23, 2018 by Nikko
Lists Creating a list list_name = ["item1", "item2", "item3"]; Call the 3rd item in the list print "The first item is: " + list_name[2] Replace item3 in the list list_name[2] = "New_Value" Append item... Read More
Python Cheat Sheet - Max, Min, Absolute Value, and Type

Python Cheat Sheet – Max, Min, Absolute Value, and Type

Posted on December 2, 2017December 23, 2018 by Nikko
Find the largest number in a set maximum = max(-5, 10, 600, 53, 55554.43) print maximum Find the smallest number in a set minimum = min(3, 5, 6) print minimum Find the absolute value of a number absol... Read More
Python Cheat Sheet - Functions

Python Cheat Sheet – Functions

Posted on December 2, 2017December 23, 2018 by Nikko
Functions are defined with three components: 1. The header, which includes the def keyword, the name of the function, and any parameters the function requires. Here’s an example: def hello_world... Read More
Python Cheat Sheet - Input

Python Cheat Sheet – Input

Posted on December 2, 2017December 23, 2018 by Nikko
Input Ask the user for their input and place into Var1 Var1 = raw_input("What variable do you want to set the variable to?" Verify that the input is not empty original = raw_input("Enter a word: ") if... Read More
Python Cheat Sheet - Comparators, Booleans, and If Statements

Python Cheat Sheet – Comparators, Booleans, and If Statements

Posted on December 1, 2017December 23, 2018 by Nikko
Comparators Comparators work with booleans to define a variable as either ‘True’ or ‘False’. For example: Var1 = 5 == 5 Var2 = 10 < 5 print(Var1) print(Var2) True False Comp... Read More
Python Cheat Sheet - The Datetime Library

Python Cheat Sheet – The Datetime Library

Posted on November 30, 2017December 23, 2018 by Nikko
Date Time Library Import the library import datetime   Print the full date now = datetime.now() print(now)   Print the year, month, day, hour, minute, or second now = datetime.now() print(no... Read More
Iscsi Connection Management

Iscsi Connection Management

Posted on November 30, 2017December 23, 2018 by Nikko
Discover new iscsi targets iscsiadm -m discovery -t st -p [Insert SAN IP] | grep [Insert name of volume] Login a new iscsi target iscsiadm -m node -T [Insert initiator name from last command] -l Logou... Read More
How to change your hostname - Ubuntu/CentOS

How to change your hostname – Ubuntu/CentOS

Posted on November 30, 2017December 23, 2018 by Nikko
CentOS Open the server’s network file vim /etc/sysconfig/network Replace the old hostname with the new hostname HOSTNAME=NewHostName Edit the hosts file vim /etc/hosts Replace any occurrence of ... Read More
Python Cheat Sheet

Python Cheat Sheet

Posted on November 29, 2017December 23, 2018 by Nikko
Variables Number/Float my_variable = 10 Boolean my_bool = True Function    def test(): var1 = 10 return var1 Strings name = "Nikko"   Print Print the output of a function print function... Read More
  • 2 of 7
  • « Previous
  • 1
  • 2
  • 3
  • 4
  • …
  • 7
  • Next »

Recent Posts

  • Puppet Format Cookbook
  • Puppet Cheat Sheet – Manifest Cook Book
  • Upgrade MySQL 5.6 to MySQL 5.7 – CentOS
  • Install MySQL 5.6 – CentOS
  • Increase the Open File Limit – CentOS

Tags

disk space docker domain git hostname Iscsi limit manifest mysql nginx puppet Python speed ssl subdomain upgrade x11

Categories

  • docker (2)
  • Git (1)
  • Iscsi (1)
  • Linux (1)
  • MySQL (2)
  • Nginx (2)
  • Puppet (2)
  • Python (8)
  • Troubleshooting (16)
  • Uncategorized (34)
Powered by Plum Theme.
© 2021 Linux Resolved. All Rights Reserved.